From d22a155a97b697dc84a0a4b1691bfb2069c49089 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 3 Oct 2024 19:53:39 +0100 Subject: [PATCH] attempt 5 --- apps/frontend/Dockerfile | 23 ++++++++++++++++++++++- apps/frontend/next.config.mjs | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/apps/frontend/Dockerfile b/apps/frontend/Dockerfile index 5a50143..ac9117c 100644 --- a/apps/frontend/Dockerfile +++ b/apps/frontend/Dockerfile @@ -16,13 +16,24 @@ RUN turbo prune frontend --docker # Add lockfile and package.json's of isolated subworkspace FROM base AS installer RUN apk update -RUN apk add --no-cache libc6-compat +RUN apk add --no-cache python3 make g++ gcc pkgconfig pixman cairo-dev libjpeg-turbo-dev pango-dev giflib-dev WORKDIR /app # First install the dependencies (as they change less often) COPY --from=builder /app/out/json/ . RUN pnpm install --frozen-lockfile --quiet +# Add the commit hash +ARG GIT_REV +ENV GIT_REV=${GIT_REV} + +# Add the sentry auth token +ARG SENTRY_AUTH_TOKEN +ENV SENTRY_AUTH_TOKEN=${SENTRY_AUTH_TOKEN} + +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 + # Build the project COPY --from=builder /app/out/full/ . RUN pnpm turbo run build --filter=frontend... @@ -30,6 +41,16 @@ RUN pnpm turbo run build --filter=frontend... FROM base AS runner WORKDIR /app +ENV NODE_ENV=production +ENV NEXT_TELEMETRY_DISABLED=1 + +# Install runtime dependencies +RUN apk add --no-cache cairo pango libjpeg-turbo giflib + +# Add the commit hash +ARG GIT_REV +ENV GIT_REV=${GIT_REV} + # Don't run production as root RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs diff --git a/apps/frontend/next.config.mjs b/apps/frontend/next.config.mjs index 777ecf8..c9e435a 100644 --- a/apps/frontend/next.config.mjs +++ b/apps/frontend/next.config.mjs @@ -9,6 +9,7 @@ const __dirname = path.dirname(__filename); // get the name of the directory /** @type {import('next').NextConfig} */ const nextConfig = { + output: "standalone", experimental: { webpackMemoryOptimizations: true, },