Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why do we need to mount volumes to the frontend and api? #21

Open
Antibioticvz opened this issue Feb 18, 2018 · 3 comments
Open

Why do we need to mount volumes to the frontend and api? #21

Antibioticvz opened this issue Feb 18, 2018 · 3 comments

Comments

@Antibioticvz
Copy link

I'm working now to make it run on aws ecs and I have some troubles to mount volumes to containers
Why do we need to copy folders(Dockerfile) to the Image build
COPY . /opt/app COPY . /opt/frontend
and also mount volumes from yml
volumes: - ./frontend/.:/opt/frontend - /opt/frontend/node_modules volumes: - ./api/.:/opt/app - /opt/app/node_modules
also we copy api and all files and next api/node_modules, is it right?
For me it's looks redundant.

@chadfurman
Copy link
Owner

We copy the folders because that is where the code is. For example, /api/Dockerfile copies in the contents of /api/.* and then that is what is run via node.

The docker-compose.yml is only used locally. The Dockerfile builds an image, so the files need to be inside the image. The docker-compose mounts the volumes so that our watch-scripts will detect changes and reload.

We are not copying in node_modules, though. We exclude node modules in the docker-compose.yml because the docker/run.sh file uses a yarn cache inside the container to make it so that modules are only downloaded when package.json changes

We also use the Dockerfile to build the image on the CI server, and that is why there is also a yarn command in there to install the modules

@Antibioticvz
Copy link
Author

That's make sense to me thank you.
So the db/Dockerfile need this COPY /postgres-data /var/lib/postgresql/data/pgdata I think

@chadfurman
Copy link
Owner

Hmmmmm maybe... /postgres-data has generally just worked for me. However, I do not rely on the postgres image but rather I use RDS and deploy my migrations as the root user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants