magnetar/Dockerfile

60 lines
1.4 KiB
Docker
Raw Normal View History

2023-11-05 20:11:07 +00:00
FROM docker.io/rust:1.73-bookworm as build
RUN update-ca-certificates
2023-11-05 19:58:25 +00:00
RUN apt update
2023-11-05 20:12:33 +00:00
RUN apt install -y git nodejs npm
2023-11-05 20:22:37 +00:00
RUN npm install -g corepack
2023-11-05 19:48:13 +00:00
ENV USER=magnetar
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
WORKDIR /magnetar
COPY ./ .
2023-07-07 19:22:30 +00:00
RUN cargo build --release --locked --workspace --bins
2023-11-05 20:54:55 +00:00
WORKDIR /magnetar/fe_calckey/frontend
2023-11-05 19:48:13 +00:00
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/debian:bullseye-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
2023-07-07 19:22:30 +00:00
WORKDIR /magnetar/fe_calckey/frontend
2023-11-05 20:54:55 +00:00
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
2023-07-07 19:22:30 +00:00
WORKDIR /magnetar
RUN chown -R 10001:10001 .
COPY --from=build /magnetar/target/release/magnetar ./
2023-07-07 19:22:30 +00:00
COPY --from=build /magnetar/target/release/magnetar_calckey_fe ./
USER magnetar:magnetar
2023-07-07 19:22:30 +00:00
EXPOSE 4938/tcp
EXPOSE 4939/tcp
2023-11-05 19:48:13 +00:00
ENTRYPOINT ["/magnetar/magnetar"]