From 9abcc62f7bb507d1bf36a2402d95802d1f8036e0 Mon Sep 17 00:00:00 2001 From: Dehemi Weerakkody <39078645+stargazer39@users.noreply.github.com> Date: Tue, 13 Aug 2024 18:30:56 +0530 Subject: [PATCH] Update Dockerfile --- Dockerfile | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index be0d820..34362d5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,16 +7,6 @@ FROM base AS deps RUN apk add --no-cache libc6-compat git # Define build arguments -ARG NEXT_PUBLIC_FIREBASE_API_KEY -ARG NEXT_PUBLIC_AUTH_DOMAIN -ARG NEXT_PUBLIC_PROJECT_ID -ARG NEXT_PUBLIC_STORAGE_BUCKET -ARG NEXT_PUBLIC_MESSAGING_SENDER_ID -ARG NEXT_PUBLIC_APP_ID -ARG NEXT_PUBLIC_MEASUREMENT_ID -ARG NEXT_PUBLIC_FIREBASE_COLLECTION_PREFIX -ARG NEXT_PUBLIC_EMAIL_ENDPOINT - # Setup pnpm environment ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" @@ -40,6 +30,16 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . +ARG NEXT_PUBLIC_FIREBASE_API_KEY +ARG NEXT_PUBLIC_AUTH_DOMAIN +ARG NEXT_PUBLIC_PROJECT_ID +ARG NEXT_PUBLIC_STORAGE_BUCKET +ARG NEXT_PUBLIC_MESSAGING_SENDER_ID +ARG NEXT_PUBLIC_APP_ID +ARG NEXT_PUBLIC_MEASUREMENT_ID +ARG NEXT_PUBLIC_FIREBASE_COLLECTION_PREFIX +ARG NEXT_PUBLIC_EMAIL_ENDPOINT + ENV NEXT_PUBLIC_FIREBASE_API_KEY=${NEXT_PUBLIC_FIREBASE_API_KEY} ENV NEXT_PUBLIC_AUTH_DOMAIN=${NEXT_PUBLIC_AUTH_DOMAIN} ENV NEXT_PUBLIC_PROJECT_ID=${NEXT_PUBLIC_PROJECT_ID} @@ -50,6 +50,8 @@ ENV NEXT_PUBLIC_MEASUREMENT_ID=${NEXT_PUBLIC_MEASUREMENT_ID} ENV NEXT_PUBLIC_FIREBASE_COLLECTION_PREFIX=${NEXT_PUBLIC_FIREBASE_COLLECTION_PREFIX} ENV NEXT_PUBLIC_EMAIL_ENDPOINT=${NEXT_PUBLIC_EMAIL_ENDPOINT} +RUN echo "Test $NEXT_PUBLIC_AUTH_DOMAIN" + RUN pnpm build @@ -63,6 +65,16 @@ ENV NODE_ENV production # Learn more here: https://nextjs.org/telemetry ENV NEXT_TELEMETRY_DISABLED 1 +ARG NEXT_PUBLIC_FIREBASE_API_KEY +ARG NEXT_PUBLIC_AUTH_DOMAIN +ARG NEXT_PUBLIC_PROJECT_ID +ARG NEXT_PUBLIC_STORAGE_BUCKET +ARG NEXT_PUBLIC_MESSAGING_SENDER_ID +ARG NEXT_PUBLIC_APP_ID +ARG NEXT_PUBLIC_MEASUREMENT_ID +ARG NEXT_PUBLIC_FIREBASE_COLLECTION_PREFIX +ARG NEXT_PUBLIC_EMAIL_ENDPOINT + ENV NEXT_PUBLIC_FIREBASE_API_KEY=${NEXT_PUBLIC_FIREBASE_API_KEY} ENV NEXT_PUBLIC_AUTH_DOMAIN=${NEXT_PUBLIC_AUTH_DOMAIN} ENV NEXT_PUBLIC_PROJECT_ID=${NEXT_PUBLIC_PROJECT_ID} @@ -73,6 +85,8 @@ ENV NEXT_PUBLIC_MEASUREMENT_ID=${NEXT_PUBLIC_MEASUREMENT_ID} ENV NEXT_PUBLIC_FIREBASE_COLLECTION_PREFIX=${NEXT_PUBLIC_FIREBASE_COLLECTION_PREFIX} ENV NEXT_PUBLIC_EMAIL_ENDPOINT=${NEXT_PUBLIC_EMAIL_ENDPOINT} +RUN echo "Test $NEXT_PUBLIC_AUTH_DOMAIN" + # Set correct permissions for nextjs user and don't run as root RUN addgroup nodejs RUN adduser -SDH nextjs