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

Add support for docker-compose. #221

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

saevarom
Copy link
Contributor

An iteration on some Makefile commands I added earlier. I realised that it was too hard to manage the container using only docker, it's much nicer to use docker-compose. This makes it easier to manage the container with volumes to make the database persistent, and for developers to make changes to the editor guide code and test them out on the running container.

I did have to make my own version of the Dockerfile but only because I couldn't override the POETRY_INSTALL_ARGS setting in the Dockerfile.

…ntainer with volumes to make the database persistent, and for developers to make changes to the editor guide code and test them out on the running container.
… the frontend container to be able to run npm commands
@@ -0,0 +1,98 @@
# (Keep the version in sync with the node install below)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: What's the value in having a separate dockerfile? The main one ought to work just fine for this.


docker-init:
docker exec -it guide_latest /bin/bash -c "make backend"
docker-compose exec web poetry install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why are dependencies being run like this? It happens during build time, which is probably fine.

Suggested change
docker-compose exec web poetry install

dockerfile: Dockerfile.localdev
extra_hosts:
- 'host.docker.internal:host-gateway'
command: poetry run python manage.py runserver 0.0.0.0:${PORT:-8000}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: If we always override the command here, why not just put it in the dockerfile?

ports:
- '${PORT:-8000}:${PORT:-8000}'
environment:
SECRET_KEY: $SECRET_KEY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we duplicating these to pass them through? I'd recommend either using dummy values, or having docker-compose read from a .env file.

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.

2 participants