-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adds dockerfile and docker compose #1
base: main
Are you sure you want to change the base?
Conversation
dockerfile
Outdated
&& \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* && \ | ||
pip install --no-cache-dir poetry==1.4.0 setuptools && poetry config virtualenvs.create false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to use poetry==1.4.0 instead of a newer one?
I think it's good to lock it, but I wonder if we can use the latest version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No reason at all, just forgot to bump the version. Nice catch!
Changed it to 1.8.3.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM, but it would be good if @deistermatheus could check as well.
docker-compose.yml
Outdated
image: slackbot-ai:latest | ||
build: . | ||
ports: | ||
- "7999:7999" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7999 was completely arbitrary, just not to clash with usual django app at 8000. The app port can be parameterized by the env, do you think this is useful to have? This is an example from the project we work on:
ports:
- "8000:8000" # fixed port
- "${DEBUG_PORT:-3000}:${DEBUG_PORT:-3000}" # parameterized port
Had a second thought when remembered debug protocol, but this can be done in other PR (expose a way for VS Code Remote Attach)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
dockerfile
Outdated
FROM install AS runtime | ||
COPY . /app/ | ||
|
||
ENTRYPOINT ["uvicorn", "project.api:app", "--host", "0.0.0.0", "--port", "7999", "--reload"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment about parameterized port, something like:
ENTRYPOINT ["uvicorn", "project.api:app", "--host", "0.0.0.0", "--port", "${PORT}", "--reload"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@docker compose start slackbot-ai | ||
|
||
docker_stop_all: | ||
@docker compose stop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could not find a place to hook this on, but maybe add *.db into .dockerignore like it is on .gitignore? the reasoning for this is that it's mapped as a volume, but building and pushing an image from your machine is going to send the sqlite db along the image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a dockerignore with the .db exclusion to be on the safe side.
LGTM with a few comments (hardcoding port and if there's a risk in not adding the sqlite db to .dockerignore) |
Adding a dockerfile and docker compose to help the DX making it easier to set up the project and make further contributions.