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

Enable multiarch for docker

This commit is contained in:
Delta1925 2023-04-23 17:11:19 +02:00
parent 9b412b9f12
commit 26a9c5fee9
No known key found for this signature in database
GPG key ID: 1C21ACE44193CB25

View file

@ -1,11 +1,11 @@
FROM rust:1.68-alpine3.17 AS bin-builder ARG base="alpine:3.17"
# Install dependencies FROM ${base} AS bin-builder
RUN apk add --no-cache openssl-dev musl-dev
RUN apk add --no-cache cargo openssl-dev musl-dev
# This will build all dependencies and store them in docker's cache. # This will build all dependencies and store them in docker's cache.
# This way, it won't be necessary to recompile everything everytime # This way, it won't be necessary to recompile everything everytime
# Disable static linking, see: https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172 # It also disables static linking, see: https://users.rust-lang.org/t/sigsegv-with-program-linked-against-openssl-in-an-alpine-container/52172
COPY backend/Cargo.toml . COPY backend/Cargo.toml .
COPY backend/Cargo.lock . COPY backend/Cargo.lock .
RUN echo '[[bin]]' >> Cargo.toml && \ RUN echo '[[bin]]' >> Cargo.toml && \
@ -15,31 +15,28 @@ RUN echo '[[bin]]' >> Cargo.toml && \
RUSTFLAGS='-C target-feature=-crt-static' cargo build --release RUSTFLAGS='-C target-feature=-crt-static' cargo build --release
RUN rm cache.rs && \ RUN rm cache.rs && \
rm Cargo.toml rm Cargo.toml
# Build wimple-wkd # Build wimple-wkd
COPY backend/Cargo.toml . COPY backend/Cargo.toml .
COPY backend/src src COPY backend/src src
RUN RUSTFLAGS='-C target-feature=-crt-static' cargo build --release RUN RUSTFLAGS='-C target-feature=-crt-static' cargo build --release
FROM node:19-alpine3.17 AS webpage-builder FROM ${base} AS webpage-builder
# Build website RUN apk add --no-cache npm
COPY website . COPY website .
RUN npm install -g pnpm && \ RUN npm install -g pnpm && \
pnpm install && \ pnpm install && \
pnpm run build pnpm run build
COPY assets assets COPY assets assets
# Move website in templates folder # Move website in templates folder
RUN mv dist assets/webpage RUN mv dist assets/webpage
FROM alpine:3.17 FROM ${base}
# Put everything together # The final image uses user `wkd` for added security
# It uses user `wkd` for added security # It also installs libgcc, because the executable is dynamically linked to it
# Install libgcc, because the executable is dynamically linked to it
WORKDIR /wkd WORKDIR /wkd
RUN apk add --no-cache libgcc && \ RUN apk add --no-cache libgcc && \
adduser --no-create-home --disabled-password wkd && \ adduser --no-create-home --disabled-password wkd && \