🌟 We are Open Source! Check out our repository on GitHub

Docker Projects Structure

A scalable and maintainable folder structure for Docker projects

File Structure

  • services
    • api
      • Dockerfile
      • src
      • package.json
    • frontend
      • Dockerfile
      • src
      • package.json
    • worker
      • Dockerfile
      • src
      • requirements.txt
  • docker
    • nginx
      • Dockerfile
      • nginx.conf
    • postgres
      • init.sql
  • scripts
    • build.sh
    • deploy.sh
    • wait-for-it.sh
  • k8s
    • deployment.yaml
    • service.yaml
    • ingress.yaml
  • docker-compose.yml
  • docker-compose.dev.yml
  • docker-compose.prod.yml
  • .dockerignore
  • .env.example
  • Makefile
  • README.md

Directory Structure Explanation

services/

Microservices architecture with each service having its own Dockerfile and source code.

services/api/

Backend API service with its own containerization and dependencies.

services/frontend/

Frontend application service with build process and static file serving.

services/worker/

Background worker service for processing jobs and tasks.

docker/nginx/

Nginx service configuration for load balancing and reverse proxy.

docker/postgres/

PostgreSQL database service with initialization scripts and configuration.

k8s/

Kubernetes manifests for deploying the application to Kubernetes clusters.

k8s/deployment.yaml

Kubernetes deployment configuration for managing application replicas.

k8s/service.yaml

Kubernetes service configuration for exposing applications within the cluster.

docker-compose.prod.yml

Production Docker Compose configuration with optimized settings and security.

Makefile

Automation file with common commands for building, testing, and deploying.