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

47 lines
1.2 KiB
Text
Raw Normal View History

2023-02-21 23:38:30 -05:00
###### [STAGE] Build ######
FROM node:20-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-21 23:38:30 -05:00
### Install toolchain ###
RUN npm add --location=global pnpm@^8.0.0
# https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#node-gyp-alpine
RUN apk add --no-cache python3 make g++ rsync
2022-11-07 06:28:34 -05:00
COPY . .
2023-02-21 23:38:30 -05:00
### Install dependencies and build ###
RUN node .scripts/update-parcelrc.js
RUN pnpm i
### Set if dev features enabled ###
ARG dev_features_enabled
ENV DEV_FEATURES_ENABLED=${dev_features_enabled}
ARG applicationinsights_connection_string
ENV APPLICATIONINSIGHTS_CONNECTION_STRING=${applicationinsights_connection_string}
2022-10-17 06:37:59 -05:00
RUN pnpm -r build
2023-02-21 23:38:30 -05:00
### Add official connectors ###
ARG additional_connector_args
ENV ADDITIONAL_CONNECTOR_ARGS=${additional_connector_args}
RUN pnpm cli connector link $ADDITIONAL_CONNECTOR_ARGS -p .
2023-02-21 23:38:30 -05:00
### Prune dependencies for production ###
2022-12-14 00:23:59 -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 packages/cloud
2023-02-21 23:38:30 -05:00
###### [STAGE] Seal ######
FROM node:20-alpine as app
WORKDIR /etc/logto
COPY --from=builder /etc/logto .
EXPOSE 3001
ENTRYPOINT ["npm", "run"]
CMD ["start"]