Im not an expert with docker, I am just getting used to it. I want to copy ssl certificates, which are generated on the host machine to my docker container. I read that it should be able to do with volumes
argument in the docker-compose file but starting my server it always excites as it cannot find the copied files within the working directory.
Folderstructure
- repo
- backend
- api
- static
- ssl
- dockerfile
- frontend
- docker-compose.yml
Dockerfile
FROM node:14-alpine
ENV NODE_ENV=production SERVER_PORT_HTTP=80 SERVER_PORT_HTTPS=443
WORKDIR /usr/src/app
RUN npm install
COPY . .
EXPOSE ${SERVER_PORT_HTTP} ${SERVER_PORT_HTTPS}
CMD [ "npm", "run", "start" ]
Docker-Compose
version: "3"
services:
api:
build:
context: ./backend/api
ports:
- "80:80"
- "443:443"
volumes:
- /etc/letsencrypt/live/api.example.com:/static/ssl
restart: unless-stopped