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-05-31 23:37:59 -05:00
|
|
|
ENV PUPPETEER_SKIP_DOWNLOAD=true
|
2023-02-20 21:44:35 -05:00
|
|
|
|
2023-02-21 23:38:30 -05:00
|
|
|
### Install toolchain ###
|
2023-03-30 05:51:20 -05:00
|
|
|
RUN npm add --location=global pnpm@^8.0.0
|
2023-02-20 21:44:35 -05:00
|
|
|
# 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-20 01:32:24 -05:00
|
|
|
ARG applicationinsights_connection_string
|
|
|
|
ENV APPLICATIONINSIGHTS_CONNECTION_STRING=${applicationinsights_connection_string}
|
2023-02-20 21:44:35 -05:00
|
|
|
RUN pnpm prepack
|
2023-04-02 01:12:30 -05:00
|
|
|
RUN pnpm connectors:build && 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 ###
|
2023-04-02 01:12:30 -05:00
|
|
|
RUN pnpm cli connector link -p .
|
2023-03-15 09:22:45 -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"]
|