Fixed the Dockerfile

This commit is contained in:
Natty 2023-11-05 20:48:13 +01:00
parent fdfd3163b1
commit b801ab83ac
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
1 changed files with 24 additions and 25 deletions

View File

@ -1,20 +1,25 @@
FROM docker.io/alpine:3.18 as build_fe FROM docker.io/rust:1.73-bookworm as build
RUN apk add --no-cache --no-progress git alpine-sdk nodejs-current npm
WORKDIR /fe_calckey
COPY ./fe_calckey/frontend ./frontend
WORKDIR /fe_calckey/frontend
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm i --frozen-lockfile
RUN env NODE_ENV=production sh -c "pnpm run build && pnpm run gulp"
FROM docker.io/rust:1.71-bullseye as build
RUN update-ca-certificates RUN update-ca-certificates
RUN apt update
RUN apt install -y git nodejs npm
RUN npm install -g corepack
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /magnetar
COPY ./ .
WORKDIR /magnetar/fe_calckey/frontend
RUN pnpm i --frozen-lockfile
WORKDIR /magnetar
RUN cargo build --release --locked --workspace --bins
WORKDIR /magnetar/fe_calckey/frontend
RUN env NODE_ENV=production sh -c "pnpm run build && pnpm run gulp"
ENV USER=magnetar ENV USER=magnetar
ENV UID=10001 ENV UID=10001
@ -26,12 +31,6 @@ RUN adduser \
--uid "${UID}" \ --uid "${UID}" \
"${USER}" "${USER}"
WORKDIR /magnetar
COPY ./ .
RUN cargo build --release --locked --workspace --bins
FROM docker.io/debian:bullseye-slim FROM docker.io/debian:bullseye-slim
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
@ -42,10 +41,10 @@ COPY --from=build /etc/group /etc/group
WORKDIR /magnetar WORKDIR /magnetar
WORKDIR /magnetar/fe_calckey/frontend WORKDIR /magnetar/fe_calckey/frontend
COPY --from=build_fe /fe_calckey/frontend/built ./built COPY --from=build /magnetar/fe_calckey/frontend/built ./built
COPY --from=build_fe /fe_calckey/frontend/assets ./assets COPY --from=build /magnetar/fe_calckey/frontend/assets ./assets
COPY --from=build_fe /fe_calckey/frontend/client/assets ./client/assets COPY --from=build /magnetar/fe_calckey/frontend/client/assets ./client/assets
COPY --from=build_fe /fe_calckey/frontend/assets-be ./assets-be COPY --from=build /magnetar/fe_calckey/frontend/assets-be ./assets-be
WORKDIR /magnetar WORKDIR /magnetar
@ -59,4 +58,4 @@ USER magnetar:magnetar
EXPOSE 4938/tcp EXPOSE 4938/tcp
EXPOSE 4939/tcp EXPOSE 4939/tcp
ENTRYPOINT ["/magnetar/magnetar"] ENTRYPOINT ["/magnetar/magnetar"]