File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66# This Dockerfile uses Node.js 24.13.0-slim, which was the latest LTS version at the time of writing.
77# To ensure security and compatibility, regularly update the NODE_VERSION ARG to the latest LTS version.
88ARG NODE_VERSION=24.13.0-slim
9+ ARG GIT_SHA=unknown
10+ ARG BUILD_TIMESTAMP=unknown
911
1012FROM node:${NODE_VERSION} AS dependencies
1113
@@ -73,13 +75,18 @@ RUN if [ -f package-lock.json ]; then \
7375
7476FROM node:${NODE_VERSION} AS runner
7577
78+ ARG GIT_SHA
79+ ARG BUILD_TIMESTAMP
80+
7681# Set working directory
7782WORKDIR /app
7883
7984# Set production environment variables
8085ENV NODE_ENV=production
8186ENV PORT=3000
8287ENV HOSTNAME="0.0.0.0"
88+ ENV APP_GIT_SHA=${GIT_SHA}
89+ ENV APP_BUILD_TIMESTAMP=${BUILD_TIMESTAMP}
8390
8491# Advertise the internal application port for platforms that auto-detect it.
8592EXPOSE 3000
Original file line number Diff line number Diff line change @@ -48,13 +48,18 @@ RUN bun run build
4848
4949FROM oven/bun:1 AS runner
5050
51+ ARG GIT_SHA=unknown
52+ ARG BUILD_TIMESTAMP=unknown
53+
5154# Set working directory
5255WORKDIR /app
5356
5457# Set production environment variables
5558ENV NODE_ENV=production
5659ENV PORT=3000
5760ENV HOSTNAME="0.0.0.0"
61+ ENV APP_GIT_SHA=${GIT_SHA}
62+ ENV APP_BUILD_TIMESTAMP=${BUILD_TIMESTAMP}
5863
5964# Advertise the internal application port for platforms that auto-detect it.
6065EXPOSE 3000
Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ services:
44 build :
55 context : .
66 dockerfile : Dockerfile.bun
7+ args :
8+ GIT_SHA : ${GIT_SHA:-unknown}
9+ BUILD_TIMESTAMP : ${BUILD_TIMESTAMP:-unknown}
710 pull_policy : build
811 image : nextjs-standalone-bun-image
912 container_name : nextjs-standalone-bun-container
@@ -19,6 +22,9 @@ services:
1922 build :
2023 context : .
2124 dockerfile : Dockerfile
25+ args :
26+ GIT_SHA : ${GIT_SHA:-unknown}
27+ BUILD_TIMESTAMP : ${BUILD_TIMESTAMP:-unknown}
2228 pull_policy : build
2329 image : nextjs-standalone-image
2430 container_name : nextjs-standalone-container
Original file line number Diff line number Diff line change 1+ import { NextResponse } from "next/server" ;
2+ import { CURRENT_VERSION } from "@/lib/changelog" ;
3+
4+ export const dynamic = "force-dynamic" ;
5+
6+ export async function GET ( ) {
7+ return NextResponse . json ( {
8+ appVersion : CURRENT_VERSION ,
9+ gitSha : process . env . APP_GIT_SHA ?? "unknown" ,
10+ buildTimestamp : process . env . APP_BUILD_TIMESTAMP ?? "unknown" ,
11+ nodeEnv : process . env . NODE_ENV ?? "unknown" ,
12+ } ) ;
13+ }
You can’t perform that action at this time.
0 commit comments