-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.aarch64
45 lines (37 loc) · 1.23 KB
/
Dockerfile.aarch64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM mcronce/rust-pgo:1.76 AS builder
ENV CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc
ARG \
RUSTC_WRAPPER \
SCCACHE_REGION \
SCCACHE_ENDPOINT \
SCCACHE_S3_USE_SSL=off \
SCCACHE_BUCKET \
AWS_ACCESS_KEY_ID \
AWS_SECRET_ACCESS_KEY
WORKDIR /repo
COPY Cargo.toml /repo/
COPY benches /repo/benches
RUN \
mkdir -v /repo/src && \
echo 'fn main() {}' > /repo/src/main.rs && \
cargo build --release --target=aarch64-unknown-linux-gnu && \
bash -exc "if [ '${RUSTC_WRAPPER}' == '/usr/bin/sccache' ]; then /usr/bin/sccache -s; fi" && \
rm -Rvf /repo/src
COPY src /repo/src
ENV RUST_LOG=info,actix-web=debug
RUN \
touch src/main.rs && \
cargo build --release --target=aarch64-unknown-linux-gnu && \
bash -exc "if [ '${RUSTC_WRAPPER}' == '/usr/bin/sccache' ]; then /usr/bin/sccache -s; fi"
RUN aarch64-linux-gnu-strip /repo/target/aarch64-unknown-linux-gnu/release/oci-registry
FROM --platform=linux/arm64 arm64v8/debian:12
RUN \
apt-get update && \
apt-get install -y ca-certificates \
&& rm -Rvf /var/lib/apt
COPY --from=builder /repo/target/aarch64-unknown-linux-gnu/release/oci-registry /usr/local/bin/oci-registry
EXPOSE 80
ENV \
PORT=80 \
RUST_LOG=info,actix-web=debug
ENTRYPOINT ["/usr/local/bin/oci-registry"]