Files
Charon/DOCKER_TASKS.md

2.3 KiB

Docker Development Tasks

Quick reference for Docker container management during development.

Available VS Code Tasks

Build & Run Local Docker

Command: Build & Run Local Docker

  • Builds the Docker image from scratch with current code
  • Tags as cpmp:local
  • Starts container with docker-compose.local.yml
  • Use when: You've made backend code changes that need recompiling

Docker: Restart Local (No Rebuild)

Command: Docker: Restart Local (No Rebuild)

  • Stops the running container
  • Starts it back up using existing image
  • Use when: You've changed volume mounts, environment variables, or want to clear runtime state
  • Fastest option for testing volume mount changes

Docker: Stop Local

Command: Docker: Stop Local

  • Stops and removes the running container
  • Preserves volumes and image
  • Use when: You need to stop the container temporarily

Docker: Start Local (Already Built)

Command: Docker: Start Local (Already Built)

  • Starts container from existing image
  • Use when: Container is stopped but image is built

Manual Commands

# Build and run (full rebuild)
docker build --build-arg VCS_REF=$(git rev-parse HEAD) -t cpmp:local . && \
docker compose -f docker-compose.local.yml up -d

# Quick restart (no rebuild) - FASTEST for volume mount testing
docker compose -f docker-compose.local.yml down && \
docker compose -f docker-compose.local.yml up -d

# View logs
docker logs -f cpmp-debug

# Stop container
docker compose -f docker-compose.local.yml down

# Start existing container
docker compose -f docker-compose.local.yml up -d

Testing Import Feature

The import feature uses a mounted Caddyfile at /import/Caddyfile inside the container.

Volume mount in docker-compose.local.yml:

- /root/docker/containers/caddy/Caddyfile:/import/Caddyfile:ro
- /root/docker/containers/caddy/sites:/import/sites:ro

To test import with different Caddyfiles:

  1. Edit /root/docker/containers/caddy/Caddyfile on the host
  2. Run task: Docker: Restart Local (No Rebuild)
  3. Check GUI - import should detect the mounted Caddyfile
  4. No rebuild needed!

Coverage Requirement

All code changes must maintain ≥80% test coverage.

Run coverage check:

cd backend && bash ../scripts/go-test-coverage.sh