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

docker-compose.yml & Dockerfile cleanup. #38

Closed
wants to merge 1 commit into from

Conversation

FlynDice
Copy link

@FlynDice FlynDice commented Oct 5, 2020

docker-compose already has the host current dir mapped to /code so there
is no need for COPY . /code/ to copy the code into the dockerfile.

WORKDIR /code is set in the dockerfile so docker-compose can just use
./manage.py to run the server.

Changed the README.md to use docker-compose build vs docker build . as
the build parameters are contained in the docker-compose.yml file.

docker-compose already has the host current dir mapped to /code so there
is no need for COPY . /code/ to copy the code into the dockerfile.

WORKDIR /code is set in the dockerfile   so docker-compose can just use
 ./manage.py to run the server.

Changed the README.md to use docker-compose build vs docker build . as
the build parameters are contained in the docker-compose.yml  file.
@phoikoi
Copy link

phoikoi commented Oct 27, 2020

If you want to create an image to be deployed, you can't rely on the /code directory being mounted, it needs to be copied in. The docker-compose file will overlay the copied code with the mount, which works for local development, but to build a deployable image, that COPY needs to be there.

@FlynDice
Copy link
Author

If by deployable you mean directly pullable as an image from a repository then I would agree with you, but I thought this was more of a beginner/starter template where using mounted directories makes things easier to work/tinker with. It is simple enough to add a production.yml file to build a container/stack with copied code & no mounted dirs for that purpose if that is what you need...

@Hesham-Aboalsoud
Copy link

Hesham-Aboalsoud commented Nov 3, 2020 via email

@FlynDice
Copy link
Author

FlynDice commented Nov 3, 2020

Well there's no db service in the docker-compose.yml file. I'm guessing you somehow changed the DATABASES variable in the settings.py file to something with a host name of "db" and django can't find it...

@wsvincent
Copy link
Owner

Hi @FlynDice, You're right the db service is left out for some reason. (Obviously an error on my part.) Going to fix now. Thanks all for the discussion.

@wsvincent wsvincent closed this Dec 21, 2020
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

Successfully merging this pull request may close these issues.

None yet

4 participants