-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
42 lines (30 loc) · 1.16 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
ARG base="alpine:3.18"
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM ${base} AS bin-builder
ARG TARGETPLATFORM
COPY --from=xx / /
# Enable cargo sparse index for faster update times, see: https://blog.rust-lang.org/inside-rust/2023/01/30/cargo-sparse-protocol.html
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
RUN apk add clang lld musl-dev cargo
COPY backend .
RUN xx-cargo build --release --target-dir ./build && \
xx-verify ./build/$(xx-cargo --print-target-triple)/release/simple-wkd
RUN mv ./build/$(xx-cargo --print-target-triple)/release/simple-wkd simple-wkd-executable
FROM --platform=$BUILDPLATFORM ${base} AS webpage-builder
RUN apk add npm
COPY website .
RUN npm install -g pnpm && \
pnpm install && \
pnpm run build
COPY assets assets
# Move website in templates folder
RUN mv dist assets/webpage
FROM ${base}
WORKDIR /wkd
COPY entrypoint.sh entrypoint.sh
COPY --from=webpage-builder assets assets
COPY --from=bin-builder simple-wkd-executable wkd
RUN apk add --no-cache libgcc && \
adduser --no-create-home --disabled-password wkd && \
chown -R wkd:wkd /wkd
ENTRYPOINT [ "sh", "/wkd/entrypoint.sh" ]