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

Adds dockerfile and docker compose #1

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

Conversation

hllustosa
Copy link

Adding a dockerfile and docker compose to help the DX making it easier to set up the project and make further contributions.

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
Copy link
Member

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.

Copy link
Author

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.

Copy link
Member

@fjsj fjsj left a 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.

image: slackbot-ai:latest
build: .
ports:
- "7999:7999"
Copy link
Collaborator

@deistermatheus deistermatheus Aug 12, 2024

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)

Copy link
Author

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"]
Copy link
Collaborator

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"]

Copy link
Author

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
Copy link
Collaborator

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.

Copy link
Author

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.

@deistermatheus
Copy link
Collaborator

Overall LGTM, but it would be good if @deistermatheus could check as well.

LGTM with a few comments (hardcoding port and if there's a risk in not adding the sqlite db to .dockerignore)

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.

3 participants