Hi,
for those that had an error in running the api container with following error:
./docker-entrypoint.sh: Permission denied
the solucion is give it a execution permission like as root:
RUN chmod +x docker-entrypoint.sh
and in yml file instead of command i use entrypoint:
entrypoint: ['sh', './docker-entrypoint.sh']
so the in api dockerfile is:
FROM node:14.16.0-alpine3.13
WORKDIR /app
RUN addgroup app && adduser -S -G app app && chown -R app /app
USER app
COPY package*.json ./
RUN npm install
COPY . .
USER root
RUN chmod +x ./docker-entrypoint.sh
# you can choose define entrypoint here or in yml file
#ENTRYPOINT ["sh", "./docker-entrypoint.sh"]
USER app
EXPOSE 3001
CMD ["npm", "start"]
in yml file :
version: '3.8'
services:
web:
build: ./frontend
ports:
- 3000:3000
volumes:
# keep node_modules folder with anonymous volume
- /app/node_modules
# bind volume to your host
- ./frontend:/app
api:
build: ./backend
ports:
- 3001:3001
environment:
DB_URL: mongodb://db/vidly
volumes:
# keep node_modules folder with anonymous volume
- /app/node_modules
# bind volume to your host
- ./backend:/app
# execute the migration script / wait-for
entrypoint: ['sh', './docker-entrypoint.sh']
db:
image: mongo:4.0-xenial
ports:
- 27017:27017
volumes:
- vidly:/data/db
volumes:
vidly: