|
||
---|---|---|
.cursor | ||
docker/template | ||
temp | ||
tests | ||
.gitignore | ||
.woodpecker.yml | ||
README.md | ||
build-test-run.sh | ||
docker-compose.dev.yml | ||
docker-compose.production.yml | ||
docker-compose.staging.yml | ||
docker-compose.test.yml | ||
stack.production.yml | ||
stack.staging.yml |
README.md
Template Project
This is a template project that follows a standardized structure for Docker-based applications.
Project Structure
./
├── .woodpecker.yml # CI configuration
├── build-test-run.sh # Convenience script for local development
├── docker/
│ └── template/ # Main application container
│ ├── Dockerfile # Base Dockerfile
│ ├── Dockerfile.production # Production-specific Dockerfile
│ └── src/ # Application source code
├── tests/ # Test scripts
├── temp/ # Local testing scratch space
├── docker-compose.dev.yml # Docker Compose for local development
├── docker-compose.production.yml
├── docker-compose.staging.yml
├── docker-compose.test.yml
├── stack.staging.yml
└── stack.production.yml
Local Development
Quick Start
The easiest way to get started with local development is to use the build-test-run.sh
script:
./build-test-run.sh
This script will:
- Build the Docker images using docker-compose.dev.yml
- Run tests if available
- Start all services in the background
- Display the URL to access the application
Development Compose File
The docker-compose.dev.yml
file is designed for local development. It includes:
- Volume mounts for code changes without rebuilding
- Debug environment variables
- Health checks
- Local ports for easy access
To use it directly:
# Build and start in one command
docker compose -f docker-compose.dev.yml up --build
# Run in the background
docker compose -f docker-compose.dev.yml up -d
# View logs
docker compose -f docker-compose.dev.yml logs -f
# Stop services
docker compose -f docker-compose.dev.yml down
Using the temp
Directory
The ./temp/
directory serves as a scratch space for local testing and development. It's designed to store temporary files that shouldn't be committed to version control, such as:
- Test output logs (e.g.,
test_output.log
) - Temporary build artifacts
- Local configuration overrides
- Mock data for testing
- Debug logs and crash reports
Example Usage
- Running tests with output:
# Test output will be written to ./temp/test_output.log
./tests/run_tests.sh > ./temp/test_output.log
- Local configuration:
# Create a local config override
cp config.yml ./temp/local_config.yml
# Edit local_config.yml for testing
- Debug logs:
# Application debug logs
docker-compose -f docker-compose.test.yml up > ./temp/debug.log
Important Notes
- The
./temp/
directory is git-ignored - Files in this directory are temporary and can be safely deleted
- Use this directory for any files that shouldn't be committed to version control
- The directory is mounted in test containers for easy access to test outputs
Development Workflow
- Start local development:
./build-test-run.sh
# or
docker compose -f docker-compose.dev.yml up --build
- Run tests:
./tests/run_tests.sh
-
Check test outputs in
./temp/
directory -
Clean up temporary files:
rm -rf ./temp/*
CI/CD
The project uses Woodpecker CI for continuous integration. The temp
directory is not included in CI builds to ensure clean, reproducible builds.