Issue
My Dockerfile for frontend in Angular:
FROM node:18.10.0 as builder
WORKDIR /app/binder-web-frontend
# WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
RUN npm install -g @angular/cli@15
COPY . .
EXPOSE 4200
ENV PORT 4200
CMD ["ng", "serve"]
docker-compose:
angular-app:
build:
context: .
dockerfile: binder-web-frontend/Dockerfile
ports:
- '4200:4200'
command: "ng serve --open --host 0.0.0.0 --port 4200 --disable-host-check"
#
# volumes:
# - ./:/app/binder-web-backend
# - /binder-web-frontend/node_modules:/app/binder-web-frontend/node_modules
# - /app/node_modules
As you can see in the screenshots, Docker itself is being built in the frontend folder ** /binder-web-frontend **.
When I run **docker-compose ** it doesn't want to copy package.json
.
The file structure is as follows: Solution/web-frontend/package.json +node_modules are also located here.
This is my first experience with Docker and I'm a bit confused. Thanks in advance for your help/advice.
Solution
change docker-compose file to:
build:
context: binder-web-frontend/.
it's becuase your docker-copose file and your Dockerfile are not in the same directory.
Answered By - Mojtaba Nejad Poor Esmaeili
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.