2024-01-07 13:35:31 +00:00
|
|
|
FROM docker.io/rust:1-alpine3.19 AS builder
|
2023-11-15 15:26:35 +00:00
|
|
|
|
|
|
|
RUN apk --no-cache add musl-dev
|
|
|
|
|
|
|
|
ENV CARGO_CARGO_NEW_VCS="none"
|
|
|
|
ENV CARGO_BUILD_RUSTFLAGS="-C target-feature=+crt-static"
|
|
|
|
|
|
|
|
WORKDIR /work
|
|
|
|
|
|
|
|
RUN cargo init
|
|
|
|
|
|
|
|
COPY Cargo.toml Cargo.lock ./
|
2023-12-15 06:57:54 +00:00
|
|
|
RUN cargo build --release --target=$(arch)-unknown-linux-musl
|
2023-11-15 15:26:35 +00:00
|
|
|
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
# ensure rebuilding of the app
|
|
|
|
RUN touch src/main.rs
|
2023-12-15 06:57:54 +00:00
|
|
|
RUN cargo build --release --target=$(arch)-unknown-linux-musl
|
|
|
|
RUN cp "./target/$(arch)-unknown-linux-musl/release/findpenguins-feed" /app
|
2023-11-15 15:26:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
|
|
|
|
COPY --from=builder /app /app
|
|
|
|
CMD ["/app"]
|