File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,15 @@ COPY --from=builder /app/out/full/ .
4444# Write env vars to .env file for Next.js to read at build time
4545RUN printenv | grep -E '^(DATABASE_URL|JWT_SECRET|NEXT_PUBLIC_|PRIVATE_KEY_|S3_|SENTRY_|SLACK_|UPLOAD_TOKEN_)' > ./apps/web/.env || true
4646
47+ # Fetch commit timestamp from GitHub API and set as build date
48+ RUN if [ -n "$SOURCE_COMMIT" ]; then \
49+ COMMIT_DATE=$(curl -sf "https://api.github.com/repos/hackclub/lapse/commits/$SOURCE_COMMIT" | grep -m1 '"date"' | head -1 | sed 's/.*"\([^"]*\)".*/\1/'); \
50+ if [ -n "$COMMIT_DATE" ]; then \
51+ TIMESTAMP_MS=$(($(date -d "$COMMIT_DATE" +%s) * 1000)); \
52+ echo "NEXT_PUBLIC_BUILD_DATE=$TIMESTAMP_MS" >> ./apps/web/.env; \
53+ fi; \
54+ fi
55+
4756RUN --mount=type=cache,id=prisma-cache,target=/root/.cache/prisma \
4857 --mount=type=cache,id=pnpm-cache,target=/root/.local/share/pnpm \
4958 NODE_ENV=production pnpm turbo run build
You can’t perform that action at this time.
0 commit comments