Files
hospitalapi/Dockerfile
Ben Melchior ba119629eb Refactor Docker setup and update API description
- Updated docker-compose.yml to use context and dockerfile for the app service, and removed unnecessary db service configuration.
- Modified Dockerfile to use the official Rust nightly image and streamlined the build process with updated working directories and runtime dependencies.
- Changed API description in root handler to reflect the correct endpoint for fetching the current hospital.
2025-05-03 21:59:23 +02:00

35 lines
830 B
Docker

# Use the official Rust nightly image as a build environment
FROM rustlang/rust:nightly-slim as builder
# Install build dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Create a new empty shell project
WORKDIR /usr/src/hospitalapi
# Copy the source code
COPY . .
# Build the application
RUN cargo build --release
# Use a minimal runtime image
FROM debian:bookworm-slim
# Install runtime dependencies
RUN apt-get update && apt-get install -y \
ca-certificates \
libssl3 \
&& rm -rf /var/lib/apt/lists/*
# Copy the binary from the builder stage
COPY --from=builder /usr/src/hospitalapi/target/release/hospitalapi /usr/local/bin/hospitalapi
# Set the working directory
WORKDIR /usr/local/bin
# Run the application
CMD ["hospitalapi"]