chore: docker build config

This commit is contained in:
ECSS 11
2026-01-13 00:56:25 -06:00
parent 60cd6097e4
commit bfbf9adf53

View File

@@ -1,4 +1,28 @@
FROM ubuntu:latest FROM rust:1.80-slim AS builder
LABEL authors="YE"
ENTRYPOINT ["top", "-b"] # Dummy app
RUN USER=root cargo new --bin app
WORKDIR /app
# Cargo build and src cleaup
COPY ./Cargo.toml ./Cargo.toml
COPY ./Cargo.lock ./Cargo.lock
RUN cargo build --release
RUN rm src/*.rs
# Copy src files
COPY ./src ./src
RUN rm ./target/release/deps/app*
RUN cargo build --release
FROM debian:bookworm-slim
# Install necessary runtime libraries
RUN apt-get update && apt-get install -y libssl-dev ca-certificates && rm -rf /var/lib/apt/lists/*
# Copy the binary from the builder stage
COPY --from=builder /app/target/release/app /usr/local/bin/app
# Set execution permissions and run
CMD ["app"]