👷 Feature: Add Dockerfile
This commit is contained in:
parent
1ad8194fe6
commit
53d04b0ce2
1 changed files with 34 additions and 0 deletions
34
Dockerfile
Normal file
34
Dockerfile
Normal 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"]
|
||||
|
Loading…
Reference in a new issue