Updating docker and switching to env files

This commit is contained in:
2025-04-13 12:30:49 -04:00
parent 5c4cdb8a72
commit 9a6a190f36
2 changed files with 15 additions and 13 deletions

View File

@@ -2,36 +2,40 @@ version: '3.8' # Use a recent version
services:
# Your Rust Application Service
app:
auth_api:
build: . # Tells docker-compose to build the Dockerfile in the current directory
container_name: icarus_auth # Optional: Give the container a specific name
ports:
# Map host port 8000 to container port 3000 (adjust as needed)
# Format: "HOST_PORT:CONTAINER_PORT"
- "8000:3000"
environment:
# environment:
# Pass environment variables to your Rust application
# RUST_LOG: info # Example: Set log level
# IMPORTANT: Configure DATABASE_URL to connect to the 'db' service
# The hostname 'db' matches the service name defined below.
DATABASE_URL: postgresql://icarus_op:password@db:5432/icarus_auth
# DATABASE_URL: postgresql://icarus_op:password@db:5432/icarus_auth
# Add any other environment variables your app needs
# APP_HOST: 0.0.0.0
# APP_PORT: 3000
env_file:
- .env
depends_on:
db:
auth_db:
condition: service_healthy # Wait for the DB to be healthy before starting the app
restart: unless-stopped # Optional: Restart policy
# PostgreSQL Database Service
db:
auth_db:
image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller)
container_name: icarus_auth_db # Optional: Give the container a specific name
environment:
# environment:
# These MUST match the user, password, and database name in the DATABASE_URL above
POSTGRES_USER: icarus_op
POSTGRES_PASSWORD: password
POSTGRES_DB: icarus_auth
# POSTGRES_USER: icarus_op
# POSTGRES_PASSWORD: password
# POSTGRES_DB: icarus_auth
env_file:
- auth_db.env
volumes:
# Persist database data using a named volume
- postgres_data:/var/lib/postgresql/data