-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
54 lines (51 loc) · 1.67 KB
/
docker-compose.yml
File metadata and controls
54 lines (51 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Define the services (containers) that make up your application.
name: codebuilder
services:
# 1. The Next.js Frontend Service
frontend:
# Build the image from the Dockerfile in the current directory.
build: .
image: codebuilder-frontend
container_name: codebuilder-frontend
# Ensure the frontend starts after the database is ready.
depends_on:
- db
# Restart the container automatically unless it is explicitly stopped.
restart: unless-stopped
# Pass the .env file to the container for environment variables.
env_file:
- ./.env
ports:
# Map port 3000 on the host to port 3000 in the container.
- "3000:3000"
networks:
# Connect this service to our custom network.
- codebuilder-net
# 2. The PostgreSQL Database Service
db:
# Use the official PostgreSQL 15 image from Docker Hub.
image: postgres:15-alpine
container_name: codebuilder-postgres-db
restart: unless-stopped
# Pass the .env file, which must contain the DB credentials.
env_file:
- ./.env
volumes:
# Mount a named volume to persist the database data.
- postgres-data:/var/lib/postgresql/data
networks:
# Connect this service to our custom network.
- codebuilder-net
# Exposing the port is crucial for our new workflow health check.
ports:
- "5434:5432"
# Define the custom network that our services will share.
networks:
codebuilder-net:
# This correctly tells Compose that the network is managed outside its control.
external: true
# Define the named volumes for persistent data storage.
volumes:
postgres-data:
external: true
name: codebuilder-postgres-data