diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fa9ec4e..5dd1b66 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -38,7 +38,7 @@ jobs: env: IMAGE_NAME: ${{ env.PROJECT_NAME }}-${{ steps.extract_branch.outputs.branch == 'main' && 'production' || 'staging' }}-client run: | - docker build --build-arg NEXT_PUBLIC_BASE_PATH=/impact-sphere -f client/Dockerfile.prod -t $IMAGE_REGISTRY/$IMAGE_NAME:$GITHUB_SHA . + docker build --build-arg-file client/.env.local -f client/Dockerfile.prod -t $IMAGE_REGISTRY/$IMAGE_NAME:$GITHUB_SHA . - name: Install doctl uses: digitalocean/action-doctl@v2 diff --git a/client/Dockerfile.prod b/client/Dockerfile.prod index 5f87942..ad0070f 100644 --- a/client/Dockerfile.prod +++ b/client/Dockerfile.prod @@ -5,11 +5,25 @@ RUN apt-get update -y && \ apt-get install -y libc6 && \ apt-get clean +ARG NEXT_PUBLIC_URL ARG NEXT_PUBLIC_BASE_PATH -ENV NEXT_PUBLIC_BASE_PATH=$NEXT_PUBLIC_BASE_PATH +ARG NEXT_PUBLIC_ENVIRONMENT +ARG NEXT_PUBLIC_API_URL +ARG NEXT_PUBLIC_GA_TRACKING_ID +ARG NEXT_PUBLIC_MAPBOX_API_TOKEN +ARG LOG_LEVEL +ARG RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED ENV NODE_ENV production ENV NEXT_TELEMETRY_DISABLED 1 +ENV NEXT_PUBLIC_URL=$NEXT_PUBLIC_URL +ENV NEXT_PUBLIC_BASE_PATH=$NEXT_PUBLIC_BASE_PATH +ENV NEXT_PUBLIC_ENVIRONMENT=$NEXT_PUBLIC_ENVIRONMENT +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_GA_TRACKING_ID=$NEXT_PUBLIC_GA_TRACKING_ID +ENV NEXT_PUBLIC_MAPBOX_API_TOKEN=$NEXT_PUBLIC_MAPBOX_API_TOKEN +ENV LOG_LEVEL=$LOG_LEVEL +ENV RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=$RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED WORKDIR /app COPY .yarn ./.yarn @@ -28,6 +42,14 @@ RUN yarn build FROM node:18.15.0-bullseye-slim AS runner ENV NODE_ENV production ENV NEXT_TELEMETRY_DISABLED 1 +ENV NEXT_PUBLIC_URL=$NEXT_PUBLIC_URL +ENV NEXT_PUBLIC_BASE_PATH=$NEXT_PUBLIC_BASE_PATH +ENV NEXT_PUBLIC_ENVIRONMENT=$NEXT_PUBLIC_ENVIRONMENT +ENV NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL +ENV NEXT_PUBLIC_GA_TRACKING_ID=$NEXT_PUBLIC_GA_TRACKING_ID +ENV NEXT_PUBLIC_MAPBOX_API_TOKEN=$NEXT_PUBLIC_MAPBOX_API_TOKEN +ENV LOG_LEVEL=$LOG_LEVEL +ENV RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=$RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED WORKDIR /app @@ -39,7 +61,6 @@ COPY --from=build --chown=nextjs:nodejs /app/client/entrypoint.sh ./entrypoint.s COPY --from=build /app/node_modules ./node_modules COPY --from=build /app/client/public ./public COPY --from=build /app/client/package.json ./package.json -COPY --from=build /app/client/.env.local ./.env.local USER nextjs