0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00
logto/Dockerfile.cloud

42 lines
1.1 KiB
Text
Raw Normal View History

2023-02-21 23:38:30 -05:00
###### [STAGE] Build ######
2023-02-20 21:44:35 -05:00
FROM node:18-alpine as builder
WORKDIR /etc/logto
ENV CI=true
2023-02-21 23:38:30 -05:00
# No need for Docker build
2023-02-20 21:44:35 -05:00
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
2023-02-21 23:38:30 -05:00
### Install toolchain ###
2023-02-20 21:44:35 -05:00
RUN npm add --location=global pnpm@^7.14.0
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#node-gyp-alpine
RUN apk add --no-cache python3 make g++
COPY . .
2023-02-21 23:38:30 -05:00
### Install dependencies ###
2023-02-20 21:44:35 -05:00
RUN node .scripts/update-parcelrc.js
RUN pnpm i
2023-02-21 23:38:30 -05:00
### Build ###
# Admin Console build env
ENV CONSOLE_PUBLIC_URL=/
ENV IS_CLOUD=1
2023-02-21 23:38:30 -05:00
# Temporarily use it for Admin Console build, will try to use runtime technique later
2023-02-24 04:30:08 -05:00
ENV ADMIN_ENDPOINT=https://admin.app.logto.dev/
2023-02-20 21:44:35 -05:00
RUN pnpm prepack
2023-02-21 23:38:30 -05:00
RUN pnpm -r --filter @logto/console --filter @logto/cloud build
2023-02-20 21:44:35 -05:00
2023-02-21 23:38:30 -05:00
### Prune dependencies for production ###
2023-02-20 21:44:35 -05:00
RUN rm -rf node_modules packages/**/node_modules
RUN NODE_ENV=production pnpm i
2023-02-21 23:38:30 -05:00
### Clean up ###
RUN rm -rf .scripts .parcel-cache pnpm-*.yaml
###### [STAGE] Seal ######
2023-02-20 21:44:35 -05:00
FROM node:18-alpine as app
2023-02-21 23:38:30 -05:00
WORKDIR /etc/logto-cloud
COPY --from=builder /etc/logto .
2023-02-20 21:44:35 -05:00
EXPOSE 3003
2023-02-21 23:38:30 -05:00
ENTRYPOINT ["npm", "run", "start:cloud"]