-
Notifications
You must be signed in to change notification settings - Fork 221
Add Docker, Docker Compose and use dockerized PostgreSQL for local testing #476
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 Docker, Docker Compose and use dockerized PostgreSQL for local testing #476
Conversation
- Introduced a `Dockerfile` to enable containerized testing environment for Django Celery Results. - Added a `compose.yml` file to orchestrate services, including a PostgreSQL container for database testing. - Enhanced `.gitignore` to exclude .env and temporary files. - Included a small update of the `README.rst` with instructions for running tests using Docker and Docker Compose. - Added `.dockerignore` to optimize Docker builds. Closes celery#475
docker/Dockerfile
Outdated
| FROM python:3.13.3-slim AS base | ||
|
|
||
| LABEL author='Diego Castro <[email protected]>' \ | ||
| org.opencontainers.image.documentation='https://github.com/celery/django-celery-results' \ |
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.
can you please explain this and make some links for this? ideally we would love to have them under celery project orgs
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.
@auvipy Not sure why I used "jazzband" here. My brain associated this project with another organization somehow... Sorry about that.
The org.opencontainers.* labels are part of the Open Container Initiative (OCI) image spec. It's just a way to add metadata to Docker images. I usually add some of them by default.
The org.opencontainers.image.documentation label is intended to point to documentation for the container image. Since this image would be introduced with this pull request and is the kind of image used to run tests locally, we didn't write any documentation for it. On the other hand, the documentation for this image would be quite minimal, since it includes all batteries out of the box.
I will adapt the URLs/values of these labels to have them under the Celery project organization.
This merge request introduces Docker and Docker Compose support to streamline the testing process for django-celery-results. It enables running tests across multiple Python and Django versions in a containerized environment, using PostgreSQL as the database backend.
Key Changes
compose.ymlfile to orchestrate services, including a PostgreSQL container for database testing.settings.pyto use environment variables for PostgreSQL configuration.tox.inito pass PostgreSQL-related environment variables for compatibility with Docker.README.rstwith instructions for running tests using Docker and Docker Compose..envand temporary files..dockerignoreto optimize Docker builds.Benefits
How to test
Ensure you've installed Docker and Docker Compose in your workstation, run
docker compose up --buildand enjoy!Additional Notes
The PostgreSQL container is configured with default credentials, which can be customized using environment variables by creating a
.envfile and declaring all the env vars used in thecompose.ymlfile.Closes #475