kotasks/Dockerfile

35 lines
717 B
Docker
Raw Normal View History

2024-08-16 00:27:19 +00:00
# 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"]