👷 Feature: Add Dockerfile

This commit is contained in:
James Musselman 2024-08-15 19:27:19 -05:00
parent 1ad8194fe6
commit 53d04b0ce2
No known key found for this signature in database
GPG key ID: 1DAEFF35ECB5D6DB

34
Dockerfile Normal file
View file

@ -0,0 +1,34 @@
# Stage 1: Build the Rust application
FROM rust:alpine as builder
# Install necessary dependencies
RUN apk add --no-cache musl-dev && \
rustup target add x86_64-unknown-linux-musl
# Set the working directory
WORKDIR /app
# Copy the source code
COPY . .
# Build the Rust binary
RUN cargo build --release --target x86_64-unknown-linux-musl
# Stage 2: Create the minimal runtime image
FROM alpine:latest
# Set the image name
LABEL name="kotasks"
# Install necessary libraries
RUN apk add --no-cache libgcc
# Set the working directory
WORKDIR /app
# Copy the built binary from the builder stage
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/kotasks .
# Run the binary
CMD ["./kotasks"]