-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile
53 lines (35 loc) · 1.26 KB
/
Dockerfile
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
ARG IMAGE
ARG IMAGE_DATE
FROM --platform=$BUILDPLATFORM $IMAGE:$TARGETARCH-$IMAGE_DATE AS builder
# docker buildx args automatically available
ARG BUILDPLATFORM
ARG TARGETPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG FEATURES="default"
ARG MODE="release"
RUN echo "Building on $BUILDPLATFORM for $TARGETOS/$TARGETARCH in $MODE mode with target $(target)" && sleep 3
RUN mkdir -p out && mkdir empty
COPY . .
#RUN --mount=type=cache,target=/usr/local/cargo/registry <<EOF
RUN <<EOF
#!/bin/bash
set -e
if [ "release" = "$MODE" ]; then
cargo build --release --features $FEATURES --target $(target)
else
cargo build --features $FEATURES --target $(target)
fi
mv target/$(target)/$MODE/rauthy out/rauthy
EOF
FROM --platform=$TARGETPLATFORM scratch
ARG TARGET_USER="10001:10001"
USER $TARGET_USER
WORKDIR /app
COPY --from=builder --chown=$TARGET_USER /work/out/rauthy ./rauthy
COPY --from=builder --chown=$TARGET_USER /work/empty ./data
COPY --from=builder --chown=$TARGET_USER /work/tls/ca-chain.pem ./tls/ca-chain.pem
COPY --from=builder --chown=$TARGET_USER /work/tls/cert-chain.pem ./tls/cert-chain.pem
COPY --from=builder --chown=$TARGET_USER /work/tls/key.pem ./tls/key.pem
COPY --from=builder --chown=$TARGET_USER /work/rauthy.deploy.cfg ./rauthy.cfg
CMD ["/app/rauthy"]