2024-07-12 14:41:34 +00:00
|
|
|
## Important! Build context is the ROOT of the project.
|
|
|
|
## this keeps the door open for future possibility of shared code between pnpm workspace packages
|
|
|
|
|
|
|
|
FROM node:20-slim AS base
|
|
|
|
|
|
|
|
FROM base AS deps
|
|
|
|
ENV PNPM_HOME="/pnpm"
|
|
|
|
ENV PATH="$PNPM_HOME:$PATH"
|
2024-08-27 07:11:24 +00:00
|
|
|
RUN corepack enable && corepack prepare --activate
|
2024-07-12 14:41:34 +00:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
FROM deps AS install
|
|
|
|
ARG NEXT_PUBLIC_SITE_URL=https://futureporn.net
|
|
|
|
ARG NEXT_PUBLIC_STRAPI_URL=https://portal.futureporn.net
|
|
|
|
ARG NEXT_PUBLIC_UPPY_COMPANION_URL=https://uppy.futureporn.net
|
|
|
|
ENV NEXT_PUBLIC_SITE_URL ${NEXT_PUBLIC_SITE_URL}
|
|
|
|
ENV NEXT_PUBLIC_STRAPI_URL ${NEXT_PUBLIC_STRAPI_URL}
|
|
|
|
ENV NEXT_PUBLIC_UPPY_COMPANION_URL ${NEXT_PUBLIC_UPPY_COMPANION_URL}
|
|
|
|
ENV NEXT_TELEMETRY_DISABLED 1
|
2024-08-13 21:18:01 +00:00
|
|
|
COPY ./certs ./certs
|
2024-07-12 14:41:34 +00:00
|
|
|
COPY pnpm-lock.yaml ./
|
|
|
|
RUN pnpm fetch
|
2024-07-14 05:20:35 +00:00
|
|
|
# COPY pnpm-lock.yaml .npmrc package.json .
|
2024-07-30 20:34:25 +00:00
|
|
|
COPY ./services/next ./services/next
|
2024-07-14 05:20:35 +00:00
|
|
|
COPY ./packages/types ./packages/types
|
|
|
|
# COPY ./packages/strapi ./packages/strapi
|
|
|
|
# COPY ./packages/image ./packages/image
|
|
|
|
# COPY ./packages/utils ./packages/utils
|
|
|
|
|
|
|
|
RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install --recursive --frozen-lockfile --prefer-offline
|
2024-07-12 14:41:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
FROM install AS dev
|
2024-08-13 21:18:01 +00:00
|
|
|
WORKDIR /app/services/next
|
2024-07-12 14:41:34 +00:00
|
|
|
CMD ["pnpm", "run", "dev"]
|
|
|
|
|
|
|
|
FROM install AS build
|
2024-07-14 05:20:35 +00:00
|
|
|
RUN pnpm run -r build
|
2024-07-14 18:00:08 +00:00
|
|
|
# RUN pnpm --filter=next deploy --prod /prod/next ## using `pnpm deploy` doesn't work and I haven't worked out why
|
|
|
|
RUN echo "next we are next we are"
|
|
|
|
RUN ls -lash /app
|
2024-07-12 14:41:34 +00:00
|
|
|
|
|
|
|
FROM deps AS next
|
|
|
|
RUN apt-get update && apt-get install -y -qq --no-install-recommends dumb-init
|
2024-07-30 20:34:25 +00:00
|
|
|
COPY --chown=node:node --from=build /app/services/next/package.json /app/services/next/pnpm-lock.yaml ./
|
2024-07-12 14:41:34 +00:00
|
|
|
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
2024-07-30 20:34:25 +00:00
|
|
|
COPY --chown=node:node --from=build /app/services/next/public ./public
|
|
|
|
COPY --chown=node:node --from=build /app/services/next/.next/standalone ./
|
|
|
|
COPY --chown=node:node --from=build /app/services/next/.next/static ./.next/static
|
2024-07-12 14:41:34 +00:00
|
|
|
ENV TZ=UTC
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
ENV HOSTNAME="0.0.0.0"
|
|
|
|
CMD [ "dumb-init", "node", "server.js" ]
|
|
|
|
|