FROM rust:alpine AS builder # Use a dummy project to ensure the crate index is up to date. RUN set -e; \ cargo new --color always /tmp/dummy; \ cargo add --color always --manifest-path /tmp/dummy/Cargo.toml serde; \ rm -rf /tmp/dummy; \ cargo new --color always --bin /app WORKDIR /app RUN apk add --no-cache \ # openssl-dev \ # pkgconfig \ musl-dev # Build dependencies with a dummy project to cache those regardless of changes # in the actual source code COPY ./Cargo.toml ./Cargo.lock /app/ RUN cargo build --color always --release --locked COPY . . RUN touch -a -m ./src/main.rs && cargo build --color always --release --locked FROM alpine AS pr # FROM debian:bullseye-slim AS pr RUN apk add --no-cache ca-certificates # RUN set -e; \ # apt-get update; \ # apt-get install -y --no-install-recommends \ # ca-certificates; \ # rm -fr /var/apt/lists/*; LABEL version="0.1.0" ENV RUST_BACKTRACE=1 ENV RUST_LOG=info COPY ./shims/pr/* /opt/resource/ COPY --from=builder /app/target/release/gitea /bin/