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

[feature] Ability to reference a docker-compose.yml file from the tox config #190

Open
AlanCoding opened this issue Oct 30, 2024 · 0 comments

Comments

@AlanCoding
Copy link

You have a way to reference a Dockerfile which already exists in someone's project:

[docker:app]
dockerfile = {toxinidir}/Dockerfile

I define the service details inside of my docker-compose.yml file. See ansible/django-ansible-base#632, and associated project, copying from the docker-compose.yml here:

---
services:
  postgres:
    image: "postgres:15"
    container_name: dab_postgres
    environment:
      POSTGRES_DB: dab_db
      POSTGRES_USER: dab
      POSTGRES_PASSWORD: dabing
    healthcheck:
      test: ["CMD", "pg_isready", "-U", "dab", "-d", "dab_db"]
      interval: 10s
      timeout: 5s
      retries: 5
    ports:
      - "55432:5432"

What I would like to do is to say "use the details from the postgres service in file xyz". That would require a reference to the docker-compose.yml file (similar to your example with Dockerfile), and the name of the service. Spitball of this:

[docker:db]
compose_file = {toxinidir}/docker-compose.yml
service = postgres

This way, I wouldn't have to maintain a separate set of parameters. For instance, my tests are going to (at some level) hard-code the database username and password. I don't want to define the postgres username/password in docker-compose.yml for manual testing, and then also in tox.ini for CI. I'd rather have just 1 source of truth.

This does not appear to be possible right now, so filing as a feature request.

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

No branches or pull requests

1 participant