-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile.x86-64
59 lines (46 loc) · 1.61 KB
/
Dockerfile.x86-64
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM mcronce/rust-pgo:1.76 AS builder
ARG \
RUSTC_WRAPPER \
SCCACHE_REGION \
SCCACHE_ENDPOINT \
SCCACHE_S3_USE_SSL=off \
SCCACHE_BUCKET \
AWS_ACCESS_KEY_ID \
AWS_SECRET_ACCESS_KEY
RUN apt-get update && apt-get install -y s3cmd ncat jq
WORKDIR /repo
COPY Cargo.toml /repo/
COPY benches /repo/benches
RUN \
mkdir -v /repo/src && \
echo 'fn main() {}' > /repo/src/main.rs && \
cargo pgo build && \
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 pgo build && \
bash -exc "if [ '${RUSTC_WRAPPER}' == '/usr/bin/sccache' ]; then /usr/bin/sccache -s; fi"
ADD tools /repo/tools
ADD testdata /repo/testdata
RUN mv -vf /repo/testdata/s3cfg ~/.s3cfg
RUN \
export LLVM_PROFILE_FILE=/repo/target/pgo-profiles/oci-registry_%m_%p.profraw && \
./tools/generate-profiles '' | sed 's/^/[ pgo] /'
RUN \
cargo pgo bolt build --with-pgo && \
bash -exc "if [ '${RUSTC_WRAPPER}' == '/usr/bin/sccache' ]; then /usr/bin/sccache -s; fi" && \
./tools/generate-profiles -bolt-instrumented | sed 's/^/[bolt] /'
RUN \
cargo pgo bolt optimize --with-pgo && \
bash -exc "if [ '${RUSTC_WRAPPER}' == '/usr/bin/sccache' ]; then /usr/bin/sccache -s; fi"
RUN strip /repo/target/x86_64-unknown-linux-gnu/release/oci-registry-bolt-optimized
FROM gcr.io/distroless/cc-debian12
COPY --from=builder /repo/target/x86_64-unknown-linux-gnu/release/oci-registry-bolt-optimized /usr/local/bin/oci-registry
EXPOSE 80
ENV \
PORT=80 \
RUST_LOG=info,actix-web=debug
ENTRYPOINT ["/usr/local/bin/oci-registry"]