0
0
Fork 0
mirror of https://git.verdigado.com/NB-Public/simple-wkd.git synced 2024-10-30 03:05:51 +01:00
simple-wkd/Dockerfile

43 lines
1.2 KiB
Docker
Raw Normal View History

2023-05-20 18:18:41 +02:00
ARG base="alpine:3.18"
2023-04-16 16:04:14 +02:00
2023-04-17 21:45:03 +02:00
2023-05-20 18:18:41 +02:00
FROM --platform=$BUILDPLATFORM tonistiigi/xx AS xx
FROM --platform=$BUILDPLATFORM ${base} AS bin-builder
ARG TARGETPLATFORM
COPY --from=xx / /
2023-04-25 14:44:14 +02:00
# Enable cargo sparse index for faster update times, see: https://blog.rust-lang.org/inside-rust/2023/01/30/cargo-sparse-protocol.html
2023-05-20 18:18:41 +02:00
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
2023-04-16 16:04:14 +02:00
2023-04-25 14:44:14 +02:00
FROM --platform=$BUILDPLATFORM ${base} AS webpage-builder
2023-04-16 16:04:14 +02:00
2023-05-20 18:18:41 +02:00
RUN apk add npm
2023-04-16 16:04:14 +02:00
COPY website .
RUN npm install -g pnpm && \
pnpm install && \
pnpm run build
COPY assets assets
2023-04-17 21:45:03 +02:00
# Move website in templates folder
2023-04-16 16:04:14 +02:00
RUN mv dist assets/webpage
2023-04-23 17:11:19 +02:00
FROM ${base}
2023-04-16 16:04:14 +02:00
2023-04-23 17:11:19 +02:00
# The final image uses user `wkd` for added security
2023-04-16 18:28:16 +02:00
WORKDIR /wkd
2023-05-20 20:51:27 +02:00
RUN apk add --no-cache libgcc && \
adduser --no-create-home --disabled-password wkd && \
chown -R wkd:wkd /wkd
2023-04-16 18:28:16 +02:00
USER wkd
2023-04-16 16:04:14 +02:00
COPY --from=webpage-builder assets assets
2023-05-20 18:18:41 +02:00
COPY --from=bin-builder simple-wkd-executable wkd
2023-04-16 18:28:16 +02:00
ENTRYPOINT [ "/wkd/wkd" ]