mirror of
https://github.com/jakejarvis/sofa.git
synced 2026-10-16 07:25:44 -04:00
Use GIT_COMMIT_SHA env var instead of execSync for Docker compatibility
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
5 files changed
+7
-14
No files matched your search
@@ -61,5 +61,7 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
build-args: |
|
||||||
|
GIT_COMMIT_SHA=${{ github.sha }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
@@ -12,7 +12,9 @@ FROM base AS builder
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
COPY . .
|
COPY . .
|
||||||
|
ARG GIT_COMMIT_SHA
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
ENV GIT_COMMIT_SHA=${GIT_COMMIT_SHA}
|
||||||
RUN pnpm build
|
RUN pnpm build
|
||||||
|
|
||||||
# --- Runner ---
|
# --- Runner ---
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ export default async function SettingsPage() {
|
|||||||
Sofa
|
Sofa
|
||||||
</a>{" "}
|
</a>{" "}
|
||||||
v{APP_VERSION}
|
v{APP_VERSION}
|
||||||
{GIT_COMMIT !== "unknown" && (
|
{GIT_COMMIT && (
|
||||||
<>
|
<>
|
||||||
{" "}
|
{" "}
|
||||||
(
|
(
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
import packageJson from "../package.json";
|
import packageJson from "../package.json" with { type: "json" };
|
||||||
|
|
||||||
export const APP_VERSION = packageJson.version;
|
export const APP_VERSION = packageJson.version;
|
||||||
export const GIT_COMMIT = process.env.GIT_COMMIT_SHA ?? "unknown";
|
export const GIT_COMMIT = process.env.GIT_COMMIT_SHA?.slice(0, 7) || "";
|
||||||
@@ -1,16 +1,5 @@
|
|||||||
import { execSync } from "node:child_process";
|
|
||||||
import type { NextConfig } from "next";
|
import type { NextConfig } from "next";
|
||||||
|
|
||||||
process.env.GIT_COMMIT_SHA = (() => {
|
|
||||||
try {
|
|
||||||
return execSync("git rev-parse --short HEAD", {
|
|
||||||
encoding: "utf-8",
|
|
||||||
}).trim();
|
|
||||||
} catch {
|
|
||||||
return "unknown";
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
const imageBaseUrl = process.env.TMDB_IMAGE_BASE_URL || "";
|
const imageBaseUrl = process.env.TMDB_IMAGE_BASE_URL || "";
|
||||||
const imageHost = imageBaseUrl
|
const imageHost = imageBaseUrl
|
||||||
? new URL(imageBaseUrl).hostname
|
? new URL(imageBaseUrl).hostname
|
||||||
|
|||||||
Reference in new issue
Block a user