Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

387
Views
Dockerizing any Angular SPA app that runs in node

There are a lot of Angular 2+ templates (for example http://coreui.io/) that run fine in Node, simply by:

npm install
npm start

However, making them run in Docker container is a challenge. I tried the standard approach to creating dockerfile but this doesn't work

Should there be a simple way of dockerizing any app that runs on Node with?

What am I missing?

This is what my dockerfile looks like (generated by yo docker):

    FROM node:latest
    WORKDIR /src
    EXPOSE 4200
    ENTRYPOINT ["npm", "start"]
    COPY . /src
    RUN npm install
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

first thing i would suggest, don't use node:latest. what version of node do you normally run? specify that version.

you probably need to create the /src folder

and you should also change ENTRYPOINT to CMD

FROM node:7.9
RUN mkdir /src
WORKDIR /src

# cache the node modules for faster re-builds
COPY ./package.json /src
RUN npm install

COPY . /src

EXPOSE 4200
CMD ["npm", "start"]

this should cover the most basic of node apps.


things do get complex quickly, though. if you need more info on building out a proper dockerfile, i have a full course on docker with nodejs: https://sub.watchmecode.net/guides/build-node-apps-in-docker/

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!