Docker changes #31
@@ -34,9 +34,8 @@ RUN --mount=type=ssh mkdir src && \
|
||||
# Copy the actual source code
|
||||
COPY src ./src
|
||||
# If you have other directories like `templates` or `static`, copy them too
|
||||
# COPY templates ./templates
|
||||
# COPY static ./static
|
||||
COPY .env ./.env
|
||||
COPY auth_db.env ./auth_db.env
|
||||
COPY migrations ./migrations
|
||||
|
||||
# << --- SSH MOUNT ADDED HERE --- >>
|
||||
@@ -63,9 +62,8 @@ COPY --from=builder /usr/src/app/target/release/icarus_auth .
|
||||
# Copy other necessary files like .env (if used for runtime config) or static assets
|
||||
# It's generally better to configure via environment variables in Docker though
|
||||
COPY --from=builder /usr/src/app/.env .
|
||||
COPY --from=builder /usr/src/app/auth_db.env .
|
||||
COPY --from=builder /usr/src/app/migrations ./migrations
|
||||
# COPY --from=builder /usr/src/app/templates ./templates
|
||||
# COPY --from=builder /usr/src/app/static ./static
|
||||
|
||||
# Expose the port your Axum app listens on (e.g., 3000 or 8000)
|
||||
EXPOSE 3000
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user