This repository has no description
1.1 kB
29 lines
1# Development only. Not for production use.
2
3FROM rust:1.96-bookworm AS build
4
5RUN apt-get update && apt-get install -y --no-install-recommends protobuf-compiler libprotobuf-dev \
6 && rm -rf /var/lib/apt/lists/*
7
8WORKDIR /src
9COPY . .
10
11# Cache mounts on the cargo registry + target dir. The binary is copied out within the same
12# RUN because the target cache mount is unmounted afterwards (a later COPY --from could not
13# see it).
14RUN --mount=type=cache,target=/usr/local/cargo/registry \
15 --mount=type=cache,target=/src/target \
16 cargo build --release -p gitmirror \
17 && cp /src/target/release/gitmirror /usr/local/bin/gitmirror
18
19FROM debian:bookworm-slim
20
21RUN apt-get update && apt-get install -y --no-install-recommends git ca-certificates tini \
22 && rm -rf /var/lib/apt/lists/*
23
24COPY --from=build /usr/local/bin/gitmirror /usr/local/bin/gitmirror
25
26EXPOSE 9000
27
28ENTRYPOINT ["/usr/bin/tini", "--"]
29CMD ["sh", "-c", "if [ -f /usr/local/share/ca-certificates/caddy.crt ]; then update-ca-certificates; fi && exec /usr/local/bin/gitmirror serve"]