+12
-21
@@ -3,12 +3,11 @@ version: '3.8' # Use a recent version
|
|||||||
services:
|
services:
|
||||||
# --- Web API ---
|
# --- Web API ---
|
||||||
api:
|
api:
|
||||||
build: # Tells docker-compose to build the Dockerfile in the current directory
|
build:
|
||||||
context: .
|
context: .
|
||||||
ssh: ["default"] # Uses host's SSH agent
|
ssh: ["default"]
|
||||||
container_name: icarus # Optional: Give the container a specific name
|
container_name: icarus
|
||||||
ports:
|
ports:
|
||||||
# Map host port 8000 to container port 3000 (adjust as needed)
|
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
@@ -17,21 +16,18 @@ services:
|
|||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
networks:
|
networks:
|
||||||
- icarus-network
|
- icarus-network
|
||||||
restart: unless-stopped # Optional: Restart policy
|
restart: unless-stopped
|
||||||
|
|
||||||
# --- Web API auth ---
|
# --- Web API auth ---
|
||||||
auth_api:
|
auth_api:
|
||||||
build:
|
build:
|
||||||
context: ../icarus_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile)
|
context: ../icarus_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile)
|
||||||
ssh: ["default"] # Uses host's SSH agent
|
ssh: ["default"]
|
||||||
dockerfile: Dockerfile # Optional: Specify if your Dockerfile has a non-standard name
|
dockerfile: Dockerfile # Optional: Specify if your Dockerfile has a non-standard name
|
||||||
container_name: auth_api
|
container_name: auth_api
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
ports:
|
ports:
|
||||||
- "8001:8001" # Map host port 8000 to container port 8000 (adjust container port based on your app's EXPOSE in Dockerfile)
|
- "8001:8001"
|
||||||
# environment:
|
|
||||||
# Environment variables your API needs, e.g., database connection
|
|
||||||
# Add other necessary environment variables
|
|
||||||
env_file:
|
env_file:
|
||||||
- ../icarus_auth/.env
|
- ../icarus_auth/.env
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -63,10 +59,9 @@ services:
|
|||||||
|
|
||||||
|
|
||||||
# PostgreSQL Database Service
|
# PostgreSQL Database Service
|
||||||
# --- icarus web api db ---
|
|
||||||
main_db:
|
main_db:
|
||||||
image: postgres:18.3-alpine # Use an official Postgres image (Alpine variant is smaller)
|
image: postgres:18.4-alpine
|
||||||
container_name: icarus_db # Optional: Give the container a specific name
|
container_name: icarus_db
|
||||||
environment:
|
environment:
|
||||||
# These MUST match the user, password, and database name in the DATABASE_URL above
|
# These MUST match the user, password, and database name in the DATABASE_URL above
|
||||||
POSTGRES_USER: ${POSTGRES_MAIN_USER:-icarus}
|
POSTGRES_USER: ${POSTGRES_MAIN_USER:-icarus}
|
||||||
@@ -76,7 +71,6 @@ services:
|
|||||||
# Persist database data using a named volume
|
# Persist database data using a named volume
|
||||||
- postgres_data:/var/lib/postgresql
|
- postgres_data:/var/lib/postgresql
|
||||||
ports:
|
ports:
|
||||||
# Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging)
|
|
||||||
- "5432:5432"
|
- "5432:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
# Checks if Postgres is ready to accept connections
|
# Checks if Postgres is ready to accept connections
|
||||||
@@ -85,14 +79,14 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
restart: always # Optional: Restart policy
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- icarus-network
|
- icarus-network
|
||||||
|
|
||||||
# --- icarus web auth api db ---
|
# --- icarus web auth api db ---
|
||||||
auth_db:
|
auth_db:
|
||||||
image: postgres:18.3-alpine # Use an official Postgres image (Alpine variant is smaller)
|
image: postgres:18.4-alpine
|
||||||
container_name: icarus_auth_db # Optional: Give the container a specific name
|
container_name: icarus_auth_db
|
||||||
environment:
|
environment:
|
||||||
# These MUST match the user, password, and database name in the DATABASE_URL above
|
# These MUST match the user, password, and database name in the DATABASE_URL above
|
||||||
POSTGRES_USER: ${POSTGRES_AUTH_USER:-icarus_op}
|
POSTGRES_USER: ${POSTGRES_AUTH_USER:-icarus_op}
|
||||||
@@ -102,7 +96,6 @@ services:
|
|||||||
# Persist database data using a named volume
|
# Persist database data using a named volume
|
||||||
- postgres_data_auth:/var/lib/postgresql
|
- postgres_data_auth:/var/lib/postgresql
|
||||||
ports:
|
ports:
|
||||||
# Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging)
|
|
||||||
- "5433:5432"
|
- "5433:5432"
|
||||||
healthcheck:
|
healthcheck:
|
||||||
# Checks if Postgres is ready to accept connections
|
# Checks if Postgres is ready to accept connections
|
||||||
@@ -111,18 +104,16 @@ services:
|
|||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
start_period: 10s
|
start_period: 10s
|
||||||
restart: always # Optional: Restart policy
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- icarus-network
|
- icarus-network
|
||||||
|
|
||||||
# Define the named volume for data persistence
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
driver: local # Use the default local driver
|
driver: local # Use the default local driver
|
||||||
postgres_data_auth:
|
postgres_data_auth:
|
||||||
driver: local # Use the default local driver
|
driver: local # Use the default local driver
|
||||||
|
|
||||||
# Define the network (optional, but good practice)
|
|
||||||
networks:
|
networks:
|
||||||
icarus-network:
|
icarus-network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|||||||
Reference in New Issue
Block a user