0

I have angular 6 application. It builds and works with no issue locally.

Now I want to create docker image. I'm following this guide https://medium.com/@tiangolo/angular-in-docker-with-nginx-supporting-environments-built-with-multi-stage-docker-builds-bb9f1724e984

The issue is that application can't find some modules when dockerizing it (fails on 7 step). When I run command from this step in console, it builds normally. How can I approach this? I'm fighting this 2 days now.

enter image description here

Dockerfile:

# Stage 0, "build-stage", based on Node.js, to build and compile the frontend
FROM tiangolo/node-frontend:10 as build-stage

WORKDIR /app

COPY package*.json /app/

RUN npm install

COPY ./ /app/

ARG configuration=production

RUN npm run build -- --output-path=./dist/out --configuration $configuration

# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
FROM nginx:1.15

COPY --from=build-stage /app/dist/out/ /usr/share/nginx/html

# Copy the default nginx.conf provided by tiangolo/node-frontend
COPY --from=build-stage /nginx.conf /etc/nginx/conf.d/default.conf
7
  • Please provide your code and a reproducible result. See this Commented Oct 17, 2018 at 15:04
  • Sorry my connection frozen, does it help now? Commented Oct 17, 2018 at 15:06
  • no it does not help, you need to physically type the contents of your Dockerfile in to your question. Screenshots do not help in this case Commented Oct 17, 2018 at 15:06
  • I think that dockerfile is not copying all components to image-source directory. I don't know how to check that or fix, so this is only my guess Commented Oct 17, 2018 at 15:15
  • 1
    I doubt your project files are copied over, stop your dockerfile from building after copying files over then run docker build . -t test-app and then docker run -it test-app bash you'll get a terminal in your docker container. Check if all files are there and correct Commented Oct 17, 2018 at 15:28

2 Answers 2

2

Solved the issue for OP as it was a problem with case sensitivity with paths.

Sign up to request clarification or add additional context in comments.

Comments

0

Everything points out that the npm install command is missing before step 7. Please add this step on the dockerfile prior to the the ng build command.

1 Comment

I've added dockerfile. It runs npm install before

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.