FROM node:20-slim AS base FROM base AS deps ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" RUN corepack enable 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 COPY package.json pnpm-lock.yaml ./ RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store pnpm install COPY ./packages/next . FROM deps AS dev COPY --from=install /app /app ENV NEXT_TELEMETRY_DISABLED 1 CMD ["pnpm", "run", "dev"] FROM install AS build COPY --chown=node:node --from=install /app/package.json /app/pnpm-lock.yaml ./ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile COPY --from=install /app /app RUN echo "hello gitea" RUN pnpm run build # FROM deps as release # # ENV NEXT_SHARP_PATH=/app/node_modules/sharp # ENV NODE_ENV=production # WORKDIR /app # COPY --from=build /app/public ./public # COPY --from=build /app/.next/standalone ./ # COPY --from=build /app/.next/static ./.next/static # CMD [ "dumb-init", "node", "server.js" ] FROM install AS release RUN apt-get update && apt-get install -y -qq --no-install-recommends dumb-init COPY --chown=node:node --from=build /app/package.json /app/pnpm-lock.yaml ./ RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile COPY --chown=node:node --from=build /app/public ./public COPY --chown=node:node --from=build /app/.next/standalone ./ COPY --chown=node:node --from=build /app/.next/static ./.next/static ENV TZ=UTC ENV NODE_ENV=production ENV HOSTNAME="0.0.0.0" CMD [ "dumb-init", "node", "server.js" ]