62 lines
1.4 KiB
Docker
62 lines
1.4 KiB
Docker
FROM docker.io/rust:1.75-bookworm as build
|
|
|
|
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 UID=10001
|
|
|
|
RUN adduser \
|
|
--disabled-password \
|
|
--gecos "" \
|
|
--shell "/sbin/nologin" \
|
|
--no-create-home \
|
|
--uid "${UID}" \
|
|
"${USER}"
|
|
|
|
FROM docker.io/debian:bookworm-slim
|
|
|
|
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
|
|
|
COPY --from=build /etc/passwd /etc/passwd
|
|
COPY --from=build /etc/group /etc/group
|
|
|
|
WORKDIR /magnetar
|
|
|
|
WORKDIR /magnetar/fe_calckey/frontend
|
|
COPY --from=build /magnetar/fe_calckey/frontend/built ./built
|
|
COPY --from=build /magnetar/fe_calckey/frontend/assets ./assets
|
|
COPY --from=build /magnetar/fe_calckey/frontend/client/assets ./client/assets
|
|
COPY --from=build /magnetar/fe_calckey/frontend/assets-be ./assets-be
|
|
|
|
WORKDIR /magnetar
|
|
|
|
RUN chown -R 10001:10001 .
|
|
|
|
COPY --from=build /magnetar/target/release/magnetar ./
|
|
COPY --from=build /magnetar/target/release/magnetar_calckey_fe ./
|
|
|
|
USER magnetar:magnetar
|
|
|
|
EXPOSE 4938/tcp
|
|
EXPOSE 4939/tcp
|
|
|
|
ENTRYPOINT ["/magnetar/magnetar"]
|