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=/
|
2023-02-22 22:38:59 -05:00
|
|
|
ENV IS_CLOUD=1
|
2023-03-10 03:13:09 -05:00
|
|
|
ARG admin_endpoint
|
|
|
|
ENV ADMIN_ENDPOINT=${admin_endpoint}
|
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-03-15 09:22:45 -05:00
|
|
|
### Add official connectors ###
|
|
|
|
RUN pnpm cli connector add --official -p .
|
|
|
|
|
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"]
|