|
| 1 | +services: |
| 2 | + app: |
| 3 | + # The container name must be "application-server" |
| 4 | + container_name: "application-server" |
| 5 | + image: "caddy:2.11-alpine" |
| 6 | + restart: always |
| 7 | + volumes: |
| 8 | + - ./caddy:/etc/caddy:ro |
| 9 | + - caddy_data:/data |
| 10 | + ports: |
| 11 | + - 8080:8080 |
| 12 | + networks: |
| 13 | + - app-network |
| 14 | + - playground-apps |
| 15 | + |
| 16 | + playground: |
| 17 | + build: |
| 18 | + context: ./playground |
| 19 | + container_name: "playground" |
| 20 | + user: "playground:${DOCKER_GID}" |
| 21 | + restart: always |
| 22 | + depends_on: |
| 23 | + app: |
| 24 | + condition: service_started |
| 25 | + db: |
| 26 | + condition: service_healthy |
| 27 | + environment: |
| 28 | + PORT: "8080" |
| 29 | + DB_HOST: "db" |
| 30 | + DB_PORT: "5432" |
| 31 | + DB_NAME: "playground" |
| 32 | + DB_USER: "playground_user" |
| 33 | + DB_PASSWORD: "playground_password" |
| 34 | + CADDY_HOST: "application-server" |
| 35 | + CADDY_PORT: "2019" |
| 36 | + CLOUD: "${templateOption:cloud}" |
| 37 | + volumes: |
| 38 | + # mount Host machine's docker.sock to container's docker.sock |
| 39 | + - /var/run/docker.sock:/var/run/docker.sock |
| 40 | + # mount Host machine's /etc/group to container's /etc/host-group |
| 41 | + - /etc/group:/etc/host-group |
| 42 | + # mount apps directory for devcontainer builds |
| 43 | + - ./apps:/workspace/apps |
| 44 | + # mount startup scripts from parent directory |
| 45 | + - ./startupscript:/workspace/startupscript |
| 46 | + # mount features directory for devcontainer features |
| 47 | + - ../../features:/workspace/features:ro |
| 48 | + networks: |
| 49 | + - playground-apps |
| 50 | + - playground |
| 51 | + |
| 52 | + db: |
| 53 | + image: "postgres:18-alpine" |
| 54 | + restart: always |
| 55 | + environment: |
| 56 | + POSTGRES_USER: "playground_user" |
| 57 | + POSTGRES_PASSWORD: "playground_password" |
| 58 | + POSTGRES_DB: "playground" |
| 59 | + volumes: |
| 60 | + - pg_data:/var/lib/postgresql/data |
| 61 | + networks: |
| 62 | + - playground |
| 63 | + healthcheck: |
| 64 | + test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"] |
| 65 | + interval: 10s |
| 66 | + timeout: 5s |
| 67 | + retries: 5 |
| 68 | + start_period: 10s |
| 69 | + |
| 70 | +volumes: |
| 71 | + caddy_data: |
| 72 | + pg_data: |
| 73 | + |
| 74 | +networks: |
| 75 | + # The Docker network must be named "app-network". This is an external network |
| 76 | + # that is created outside of this docker-compose file. |
| 77 | + app-network: |
| 78 | + external: true |
| 79 | + playground: |
| 80 | + playground-apps: |
0 commit comments