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

Mounting the entire root source directory is bad practice #183

Open
eladavron opened this issue Apr 18, 2024 · 0 comments
Open

Mounting the entire root source directory is bad practice #183

eladavron opened this issue Apr 18, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@eladavron
Copy link
Contributor

Docker containers should contain as little content as possible, and when possible - not be live.
Using:

volumes:
  - .:/app

Both loads the container with a lot of unnecessary files AND makes it "live", meaning that any changes in the source code automatically get applied inside the container, which is an antipattern. Containers should be self-sustaining and isolated.
Mounting source code like this should only be done for debugging.

A few required corrections:

  • In the Dockerfiles, use the COPY or ADD directives to copy the necessary files to the container image, as selectively as possible.
  • Maintain a seperate docker-compose.yaml file for debugging and for production, with only the debugging one containing the mounting.
  • The style container might also be redundant in such a case - just compile SASS once and avoid having to use watch (since again, that is for live debugging)
@eladavron eladavron added the bug Something isn't working label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant