diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index cdea0b4..fb65f48 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -34,6 +34,9 @@ WORKDIR /app RUN apk add --no-cache ffmpeg +ARG commit=0 +ENV commit=$commit + # Don't run production as root RUN addgroup --system --gid 1001 nodejs RUN adduser --system --uid 1001 nextjs diff --git a/apps/web/next.config.mjs b/apps/web/next.config.mjs index e1fc081..57bdb57 100644 --- a/apps/web/next.config.mjs +++ b/apps/web/next.config.mjs @@ -1,6 +1,7 @@ import * as path from 'node:path'; import { fileURLToPath } from 'url'; import { readFileSync } from 'node:fs'; +import { execSync } from 'node:child_process'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -12,7 +13,8 @@ const LIVE_SERVER_URL = const packageJson = JSON.parse(readFileSync('./package.json', 'utf8')); const { version } = packageJson; -const commit = process.env.commit || process.env.NEXT_PUBLIC_COMMIT || 'unknown'; +const commit = process.env.commit || execSync('git rev-parse --short HEAD') + .toString().trim(); /** @type {import('next').NextConfig} */ const nextConfig = { images: {