30 lines
1.0 KiB
Docker
30 lines
1.0 KiB
Docker
#FROM lukemathwalker/cargo-chef:latest-rust-1.91.1-alpine3.22 AS chef
|
|
#FROM rust:1.91.1-alpine3.22 AS chef
|
|
FROM clux/muslrust:stable AS chef
|
|
USER root
|
|
RUN cargo install cargo-chef
|
|
WORKDIR /app
|
|
|
|
FROM chef AS planner
|
|
COPY ./Cargo.toml ./
|
|
COPY ./Cargo.lock ./
|
|
COPY ./src ./src
|
|
ENV RUST_BACKTRACE=1
|
|
RUN cargo chef prepare --recipe-path recipe.json
|
|
|
|
FROM chef AS builder
|
|
COPY --from=planner /app/recipe.json recipe.json
|
|
ENV RUST_BACKTRACE=1
|
|
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
|
|
COPY . .
|
|
RUN cargo build --release --target x86_64-unknown-linux-musl --bin atlas_consumer
|
|
|
|
FROM alpine:3.22 AS runtime
|
|
RUN addgroup -S station && adduser -S station -G station
|
|
WORKDIR /app
|
|
COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/atlas_consumer /usr/local/bin/
|
|
#RUN chown station: /app/atlas_producer && chmod u+x /usr/local/bin/atlas_producer
|
|
RUN chown -R station: /app
|
|
RUN chmod og+rx /usr/local/bin/atlas_consumer
|
|
USER station
|
|
ENTRYPOINT ["/usr/local/bin/atlas_consumer"] |