Hi,
I have a problem that I don't understand fully. I have a folder with docker-compose and Dockerfile. Container is being built, but I have error that npm can't find file or directory with package.json. When I'm mobing these 2 files to main root it's working like a charm. So probably there is a mistake in docker-compose or Dockerfile. Could someone advise me something, please.
app structure:
app
--docker-compose
----docker-compose.yml
----Dockerfile
--package.json
--...
services:
dev:
container_name: animals_api_dev
image: animals-api-dev:1.0.0
build:
context: ../
target: development
dockerfile: ./docker-compose/Dockerfile
command: npm run start:debug
ports:
- ${SERVER_PORT}:${SERVER_PORT}
environment:
- MONGO_HOST=${MONGO_HOST}
- MONGO_PORT=${MONGO_PORT}
- MONGO_USERNAME=${MONGO_USERNAME}
- MONGO_PASSWORD=${MONGO_PASSWORD}
networks:
- animals-api-network
depends_on:
- mongo-database
- mongo-express
- redis
volumes:
- .:/usr/src/app
restart: unless-stopped
networks:
animals-api-network:
driver: bridge
Dockerfile:
FROM node:18-alpine As development
WORKDIR /usr/src/app
COPY --chown=node:node package*.json ./
RUN npm ci
COPY --chown=node:node . .
USER node
