27 lines
667 B
Docker
27 lines
667 B
Docker
# Use a Rust base image with Cargo installed
|
|
FROM rust:1.90 AS builder
|
|
LABEL authors="Martin Berg Alstad"
|
|
|
|
# Set the working directory inside the container
|
|
WORKDIR /usr/src/app
|
|
|
|
# Now copy the source code
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY ./src ./src
|
|
|
|
# Build your application
|
|
RUN cargo build --release
|
|
|
|
# Start a new stage to create a smaller image without unnecessary build dependencies
|
|
FROM debian:trixie-slim
|
|
|
|
# Set the working directory
|
|
WORKDIR /usr/src/app
|
|
|
|
# Copy the built binary from the previous stage
|
|
COPY --from=builder /usr/src/app/target/release/recurring-event-api ./
|
|
|
|
EXPOSE 8000
|
|
|
|
# Command to run the application
|
|
ENTRYPOINT ["./recurring-event-api"] |