2023-08-17 10:25:11 +08:00
|
|
|
# base image
|
2024-01-24 16:24:50 +08:00
|
|
|
FROM node:20.11-alpine3.19 AS base
|
2024-01-19 18:11:47 +08:00
|
|
|
LABEL maintainer="takatost@gmail.com"
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2024-01-19 20:30:36 +08:00
|
|
|
RUN apk add --no-cache tzdata
|
|
|
|
|
|
|
|
|
2023-08-17 10:25:11 +08:00
|
|
|
# install packages
|
|
|
|
FROM base as packages
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-08-17 10:25:11 +08:00
|
|
|
WORKDIR /app/web
|
|
|
|
|
|
|
|
COPY package.json .
|
|
|
|
COPY yarn.lock .
|
|
|
|
|
2024-01-19 18:11:47 +08:00
|
|
|
RUN yarn install --frozen-lockfile
|
2023-08-17 10:25:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
# build resources
|
|
|
|
FROM base as builder
|
|
|
|
WORKDIR /app/web
|
|
|
|
COPY --from=packages /app/web/ .
|
|
|
|
COPY . .
|
|
|
|
|
|
|
|
RUN yarn build
|
|
|
|
|
|
|
|
|
|
|
|
# production stage
|
|
|
|
FROM base as production
|
|
|
|
|
2023-08-18 10:42:44 +08:00
|
|
|
ENV NODE_ENV production
|
2023-05-15 08:51:32 +08:00
|
|
|
ENV EDITION SELF_HOSTED
|
|
|
|
ENV DEPLOY_ENV PRODUCTION
|
2023-07-14 11:19:26 +08:00
|
|
|
ENV CONSOLE_API_URL http://127.0.0.1:5001
|
|
|
|
ENV APP_API_URL http://127.0.0.1:5001
|
2023-08-17 10:25:11 +08:00
|
|
|
ENV PORT 3000
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2024-01-19 20:30:36 +08:00
|
|
|
# set timezone
|
|
|
|
ENV TZ UTC
|
|
|
|
RUN ln -s /usr/share/zoneinfo/${TZ} /etc/localtime \
|
|
|
|
&& echo ${TZ} > /etc/timezone
|
2023-05-15 08:51:32 +08:00
|
|
|
|
|
|
|
WORKDIR /app/web
|
2023-08-17 13:07:07 +08:00
|
|
|
COPY --from=builder /app/web/public ./public
|
2023-08-17 10:25:11 +08:00
|
|
|
COPY --from=builder /app/web/.next/standalone ./
|
|
|
|
COPY --from=builder /app/web/.next/static ./.next/static
|
2023-05-15 08:51:32 +08:00
|
|
|
|
2023-08-05 17:23:57 +08:00
|
|
|
|
2023-08-17 10:25:11 +08:00
|
|
|
COPY docker/entrypoint.sh ./entrypoint.sh
|
2023-05-15 08:51:32 +08:00
|
|
|
|
|
|
|
ARG COMMIT_SHA
|
|
|
|
ENV COMMIT_SHA ${COMMIT_SHA}
|
|
|
|
|
2023-08-17 10:25:11 +08:00
|
|
|
EXPOSE 3000
|
2024-01-18 19:12:40 +08:00
|
|
|
ENTRYPOINT ["/bin/sh", "./entrypoint.sh"]
|