App now builds with docker

This commit is contained in:
2025-04-10 20:47:22 -04:00
parent c8ac1025b2
commit 7e59b8a852
2 changed files with 9 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
# Stage 1: Build the application # Stage 1: Build the application
# Use a specific Rust version for reproducibility. Choose one that matches your development environment. # Use a specific Rust version for reproducibility. Choose one that matches your development environment.
# Using slim variant for smaller base image # Using slim variant for smaller base image
FROM rust:1.86-slim as builder FROM rust:1.86 as builder
# Set the working directory inside the container # Set the working directory inside the container
WORKDIR /usr/src/app WORKDIR /usr/src/app
@@ -11,7 +11,8 @@ WORKDIR /usr/src/app
# Install build dependencies if needed (e.g., git for cloning) # Install build dependencies if needed (e.g., git for cloning)
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
pkg-config libssl-dev \ pkg-config libssl3 \
ca-certificates \
openssh-client git \ openssh-client git \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
@@ -47,10 +48,10 @@ RUN --mount=type=ssh \
# Stage 2: Create the final, smaller runtime image # Stage 2: Create the final, smaller runtime image
# Use a minimal base image like debian-slim or even distroless for security/size # Use a minimal base image like debian-slim or even distroless for security/size
FROM debian:bullseye-slim FROM ubuntu:24.04
# Install runtime dependencies if needed (e.g., SSL certificates) # Install runtime dependencies if needed (e.g., SSL certificates)
RUN apt-get update && apt-get install -y ca-certificates libssl-dev && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y ca-certificates libssl-dev libssl3 && rm -rf /var/lib/apt/lists/*
# Set the working directory # Set the working directory
WORKDIR /usr/local/bin WORKDIR /usr/local/bin

View File

@@ -1,4 +1,4 @@
version: '0.3' # Use a recent version version: '3.8' # Use a recent version
services: services:
# Your Rust Application Service # Your Rust Application Service
@@ -14,7 +14,7 @@ services:
# RUST_LOG: info # Example: Set log level # RUST_LOG: info # Example: Set log level
# IMPORTANT: Configure DATABASE_URL to connect to the 'db' service # IMPORTANT: Configure DATABASE_URL to connect to the 'db' service
# The hostname 'db' matches the service name defined below. # The hostname 'db' matches the service name defined below.
DATABASE_URL: postgresql://icarus_op_test:mypassword@db:5432/icarus_auth_test DATABASE_URL: postgresql://icarus_op:password@db:5432/icarus_auth
# Add any other environment variables your app needs # Add any other environment variables your app needs
# APP_HOST: 0.0.0.0 # APP_HOST: 0.0.0.0
# APP_PORT: 3000 # APP_PORT: 3000
@@ -29,9 +29,9 @@ services:
container_name: icarus_auth_db # Optional: Give the container a specific name 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 # These MUST match the user, password, and database name in the DATABASE_URL above
POSTGRES_USER: icarus_op_test POSTGRES_USER: icarus_op
POSTGRES_PASSWORD: password POSTGRES_PASSWORD: password
POSTGRES_DB: icarus_auth_test POSTGRES_DB: icarus_auth
volumes: volumes:
# Persist database data using a named volume # Persist database data using a named volume
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data