2024-05-09 21:02:42 +00:00
|
|
|
# *****************************************************************************
|
2024-01-09 17:20:51 +00:00
|
|
|
# STAGE 1: Build the project
|
2024-05-09 21:02:42 +00:00
|
|
|
# *****************************************************************************
|
2022-12-12 20:36:25 +00:00
|
|
|
FROM node:18-alpine AS builder
|
2022-12-01 18:58:31 +00:00
|
|
|
RUN apk add --no-cache libc6-compat
|
|
|
|
# Set working directory
|
|
|
|
WORKDIR /app
|
|
|
|
|
2023-02-21 06:01:43 +00:00
|
|
|
RUN yarn global add turbo
|
|
|
|
COPY . .
|
2022-12-01 18:58:31 +00:00
|
|
|
|
2023-09-03 13:20:30 +00:00
|
|
|
RUN turbo prune --scope=web --docker
|
2022-12-01 18:58:31 +00:00
|
|
|
|
2024-05-09 21:02:42 +00:00
|
|
|
# *****************************************************************************
|
2024-01-09 17:20:51 +00:00
|
|
|
# STAGE 2: Install dependencies & build the project
|
2024-05-09 21:02:42 +00:00
|
|
|
# *****************************************************************************
|
2022-12-01 18:58:31 +00:00
|
|
|
# Add lockfile and package.json's of isolated subworkspace
|
2022-12-12 20:36:25 +00:00
|
|
|
FROM node:18-alpine AS installer
|
2022-12-01 18:58:31 +00:00
|
|
|
|
|
|
|
RUN apk add --no-cache libc6-compat
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
# First install the dependencies (as they change less often)
|
|
|
|
COPY .gitignore .gitignore
|
|
|
|
COPY --from=builder /app/out/json/ .
|
2023-02-21 06:01:43 +00:00
|
|
|
COPY --from=builder /app/out/yarn.lock ./yarn.lock
|
2023-06-30 04:23:44 +00:00
|
|
|
RUN yarn install --network-timeout 500000
|
2022-12-01 18:58:31 +00:00
|
|
|
|
|
|
|
# Build the project
|
|
|
|
COPY --from=builder /app/out/full/ .
|
|
|
|
COPY turbo.json turbo.json
|
2024-04-08 09:31:17 +00:00
|
|
|
|
2024-05-09 21:02:42 +00:00
|
|
|
ARG NEXT_PUBLIC_API_BASE_URL=""
|
2023-09-13 14:51:02 +00:00
|
|
|
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
|
2023-09-04 13:16:10 +00:00
|
|
|
|
2024-05-09 21:02:42 +00:00
|
|
|
ARG NEXT_PUBLIC_ADMIN_BASE_URL=""
|
|
|
|
ENV NEXT_PUBLIC_ADMIN_BASE_URL=$NEXT_PUBLIC_ADMIN_BASE_URL
|
2022-12-12 20:36:25 +00:00
|
|
|
|
2024-05-10 09:53:51 +00:00
|
|
|
ARG NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
|
2024-05-09 21:02:42 +00:00
|
|
|
ENV NEXT_PUBLIC_ADMIN_BASE_PATH=$NEXT_PUBLIC_ADMIN_BASE_PATH
|
2024-01-09 17:20:51 +00:00
|
|
|
|
2024-05-09 21:02:42 +00:00
|
|
|
ARG NEXT_PUBLIC_SPACE_BASE_URL=""
|
|
|
|
ENV NEXT_PUBLIC_SPACE_BASE_URL=$NEXT_PUBLIC_SPACE_BASE_URL
|
|
|
|
|
2024-05-10 09:53:51 +00:00
|
|
|
ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
|
2024-05-09 21:02:42 +00:00
|
|
|
ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
|
2024-01-09 17:20:51 +00:00
|
|
|
|
2024-05-23 08:08:20 +00:00
|
|
|
ARG NEXT_PUBLIC_WEB_BASE_URL=""
|
|
|
|
ENV NEXT_PUBLIC_WEB_BASE_URL=$NEXT_PUBLIC_WEB_BASE_URL
|
|
|
|
|
2024-05-09 21:02:42 +00:00
|
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
|
|
|
ENV TURBO_TELEMETRY_DISABLED 1
|
|
|
|
|
|
|
|
RUN yarn turbo run build --filter=web
|
|
|
|
|
|
|
|
# *****************************************************************************
|
|
|
|
# STAGE 3: Copy the project and start it
|
|
|
|
# *****************************************************************************
|
2022-12-12 20:36:25 +00:00
|
|
|
FROM node:18-alpine AS runner
|
2022-12-01 18:58:31 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
2023-09-03 13:20:30 +00:00
|
|
|
COPY --from=installer /app/web/next.config.js .
|
|
|
|
COPY --from=installer /app/web/package.json .
|
2022-12-01 18:58:31 +00:00
|
|
|
|
|
|
|
# Automatically leverage output traces to reduce image size
|
|
|
|
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
2024-04-08 09:31:17 +00:00
|
|
|
COPY --from=installer /app/web/.next/standalone ./
|
|
|
|
COPY --from=installer /app/web/.next ./web/.next
|
|
|
|
COPY --from=installer /app/web/public ./web/public
|
2023-05-03 08:06:55 +00:00
|
|
|
|
2023-09-13 14:51:02 +00:00
|
|
|
ARG NEXT_PUBLIC_API_BASE_URL=""
|
|
|
|
ENV NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL
|
2023-05-03 08:06:55 +00:00
|
|
|
|
2024-05-09 21:02:42 +00:00
|
|
|
ARG NEXT_PUBLIC_ADMIN_BASE_URL=""
|
|
|
|
ENV NEXT_PUBLIC_ADMIN_BASE_URL=$NEXT_PUBLIC_ADMIN_BASE_URL
|
|
|
|
|
2024-05-10 09:53:51 +00:00
|
|
|
ARG NEXT_PUBLIC_ADMIN_BASE_PATH="/god-mode"
|
2024-05-09 21:02:42 +00:00
|
|
|
ENV NEXT_PUBLIC_ADMIN_BASE_PATH=$NEXT_PUBLIC_ADMIN_BASE_PATH
|
|
|
|
|
2024-05-23 08:08:20 +00:00
|
|
|
ARG NEXT_PUBLIC_SPACE_BASE_URL=""
|
2024-05-09 21:02:42 +00:00
|
|
|
ENV NEXT_PUBLIC_SPACE_BASE_URL=$NEXT_PUBLIC_SPACE_BASE_URL
|
|
|
|
|
2024-05-10 09:53:51 +00:00
|
|
|
ARG NEXT_PUBLIC_SPACE_BASE_PATH="/spaces"
|
2024-05-09 21:02:42 +00:00
|
|
|
ENV NEXT_PUBLIC_SPACE_BASE_PATH=$NEXT_PUBLIC_SPACE_BASE_PATH
|
2023-05-03 08:06:55 +00:00
|
|
|
|
2024-05-23 08:08:20 +00:00
|
|
|
ARG NEXT_PUBLIC_WEB_BASE_URL=""
|
|
|
|
ENV NEXT_PUBLIC_WEB_BASE_URL=$NEXT_PUBLIC_WEB_BASE_URL
|
|
|
|
|
2023-02-21 06:01:43 +00:00
|
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
2024-05-08 17:31:20 +00:00
|
|
|
ENV TURBO_TELEMETRY_DISABLED 1
|
2022-12-12 20:36:25 +00:00
|
|
|
|
2023-02-21 06:01:43 +00:00
|
|
|
EXPOSE 3000
|