From 53d04b0ce283aec39a22a924d43387f609a0885c Mon Sep 17 00:00:00 2001 From: Musselman Date: Thu, 15 Aug 2024 19:27:19 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Feature:=20Add=20Dockerfile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d30185c --- /dev/null +++ b/Dockerfile @@ -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"] +