Containerfile and compose
This commit is contained in:
27
Containerfile
Normal file
27
Containerfile
Normal file
@ -0,0 +1,27 @@
|
||||
# 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"]
|
Reference in New Issue
Block a user