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

45 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
ENV PUPPETEER_SKIP_DOWNLOAD=true
2023-02-20 21:44:35 -05:00
2023-02-21 23:38:30 -05:00
### Install toolchain ###
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=/
ENV IS_CLOUD=1
ARG applicationinsights_connection_string
ENV APPLICATIONINSIGHTS_CONNECTION_STRING=${applicationinsights_connection_string}
2023-02-20 21:44:35 -05:00
RUN pnpm prepack
RUN pnpm connectors:build && pnpm -r --filter @logto/console --filter @logto/cloud build
2023-02-20 21:44:35 -05:00
### Add official connectors ###
RUN pnpm cli connector link -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"]