-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (43 loc) · 1.67 KB
/
Dockerfile
File metadata and controls
51 lines (43 loc) · 1.67 KB
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
FROM --platform=${BUILDPLATFORM} alpine:edge AS builder
RUN apk add --no-cache mise build-base mimalloc
ENV PATH="$PATH:/mise/shims"
ENV MISE_DATA_DIR=/mise
ENV MISE_CONFIG_DIR=/mise
ENV MISE_CACHE_DIR=/cache/mise
ENV MISE_ALWAYS_KEEP_DOWNLOAD=true
ENV MISE_TRUSTED_CONFIG_PATHS=/
WORKDIR /
ADD mise.toml mise.toml
RUN --mount=type=cache,target=${MISE_CACHE_DIR} \
--mount=type=cache,target=${MISE_DATA_DIR}/downloads \
--mount=type=cache,target=/root/.rustup \
--mount=type=cache,target=/root/.cargo/git/db \
--mount=type=cache,target=/root/.cargo/registry \
mise install && \
rustup target add aarch64-unknown-linux-musl x86_64-unknown-linux-musl \
aarch64-unknown-linux-gnu x86_64-unknown-linux-gnu
WORKDIR /build
RUN --mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
--mount=type=cache,target=/build/target/ \
--mount=type=cache,target=/root/.rustup \
--mount=type=cache,target=/root/.cargo/git/db \
--mount=type=cache,target=/root/.cargo/registry \
cargo fetch --locked
ARG TARGETARCH
ENV TARGETARCH=${TARGETARCH}
WORKDIR /build
RUN --mount=type=bind,source=docker/build.sh,target=docker/build.sh \
--mount=type=bind,source=src,target=src \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
--mount=type=cache,target=/build/target/ \
--mount=type=cache,target=/root/.rustup \
--mount=type=cache,target=/root/.cargo/git/db \
--mount=type=cache,target=/root/.cargo/registry \
sh docker/build.sh
FROM scratch AS operator
WORKDIR /app
COPY --from=builder /out/static/operator /app/operator
USER 65535:65535
ENTRYPOINT [ "/app/operator" ]