# docker-compose.yml — lifecycle template.
#
# Copy to docker-compose.yml (gitignored by default in some projects) and edit.
# Naming law: every service MUST set container_name with a project prefix.
# Never rely on Docker's default `
_` naming.
# PROJECT_PREFIX should match this repo's name (lowercase, hyphenated).
# Define it once here and reuse via interpolation where supported.
services:
example:
image: alpine:3.20 # pin every image — no :latest
container_name: ${PROJECT_NAME:-project}-example
restart: unless-stopped
environment:
- LOG_LEVEL=${LOG_LEVEL:-info}
# Bind-mount the repo so in-container work stays host-owned.
volumes:
- ./:/data
working_dir: /data
# Pin resource limits appropriate to a cluster-of-1 default.
deploy:
resources:
limits:
cpus: '0.50'
memory: 256M