Skip to content

larsderidder/docker-compose-development-env

Repository files navigation

Docker-compose development env

Starter / example development environment for a project containing a Java and Python service running in Docker compose. It demonstrates a number of important concepts for efficient development in Docker, such as code watching, continuous testing, and some dependency management.

Created for the purpose of this article. Have a look if you would like to learn more.

Note that the article has been written for older versions of the mentioned software. This repository is still fairly up to date with latest methods though.

What is here

Services:

  • python: runs mypackage/run.py with watchmedo for live reload.
  • python-tests: runs pytest on file changes.
  • java: runs mvn clean compile exec:java on file changes.
  • go: runs go run . on file changes.
  • postgres: backing database for both app services.
  • pgadminer: Adminer UI on http://127.0.0.1:99.

Key files:

  • docker-compose.common.yml: base config shared across environments.
  • docker-compose.dev.yml: dev overrides (volumes, watchers, local builds).
  • docker-compose.prod.yml: prod image references.
  • python/pyproject.toml: Python package metadata and dev deps.
  • java/pom.xml: Maven config and plugins.
  • go/go.mod: Go module metadata.

Quick start

Build and run the dev stack:

docker compose -f docker-compose.common.yml -f docker-compose.dev.yml up --build

Stop everything:

docker compose -f docker-compose.common.yml -f docker-compose.dev.yml down

Run the Python tests once:

./python-tests.sh

Quick smoke test (build, start, basic health checks):

./smoke-test.sh

Notes and conventions

  • Python deps live in python/pyproject.toml. Dev tooling is in the dev extra, and python/requirements.txt installs -e .[dev] for the containers.
  • Java dev mode uses entr non-interactively; it expects file change events under java/src.
  • Go dev mode uses entr to run go run . on any *.go file change.
  • The dev compose file uses local build: for images. Registry image lines are kept as commented references.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published