Skip to content

Conversation

@diegocastrum
Copy link
Contributor

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

  • Dockerfile: Added a Dockerfile to create a containerized environment for running tests using Tox.
  • Docker Compose: Introduced a compose.yml file to orchestrate services, including a PostgreSQL container for database testing.
  • Database Configuration: Updated settings.py to use environment variables for PostgreSQL configuration.
  • Tox Configuration: Modified tox.ini to pass PostgreSQL-related environment variables for compatibility with Docker.
  • Documentation: Added a small update for README.rst with instructions for running tests using Docker and Docker Compose.
  • Enhanced .gitignore to exclude .env and temporary files.
  • Added .dockerignore to optimize Docker builds.

Benefits

  • Simplifies the setup process for running tests locally.
  • Ensures consistent and reproducible test environments.
  • Supports testing across multiple Python and Django versions.
  • Reduces manual configuration for database setup.

How to test
Ensure you've installed Docker and Docker Compose in your workstation, run docker compose up --build and enjoy!

Additional Notes
The PostgreSQL container is configured with default credentials, which can be customized using environment variables by creating a .env file and declaring all the env vars used in the compose.yml file.

Closes #475

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

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

Copy link
Contributor Author

@diegocastrum diegocastrum May 12, 2025

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.

@auvipy auvipy merged commit 5e0b2c6 into celery:main May 19, 2025
25 checks passed
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.

Integrate Docker to streamline the testing process for multiple Python and Django versions locally

2 participants