diff --git a/.github/workflows/ccip-server-docker.yml b/.github/workflows/ccip-server-docker.yml index c324ad85190..4477ad7e3a5 100644 --- a/.github/workflows/ccip-server-docker.yml +++ b/.github/workflows/ccip-server-docker.yml @@ -110,6 +110,7 @@ jobs: platforms: ${{ steps.determine-platforms.outputs.platforms }} build-args: | FOUNDRY_VERSION=${{ steps.foundry-version.outputs.FOUNDRY_VERSION }} + SERVICE_VERSION=${{ steps.taggen.outputs.TAG_SHA }}-${{ steps.taggen.outputs.TAG_DATE }} - name: Comment image tags on PR if: github.event_name == 'pull_request' diff --git a/typescript/ccip-server/Dockerfile b/typescript/ccip-server/Dockerfile index c903a7d3477..e3486b01a61 100644 --- a/typescript/ccip-server/Dockerfile +++ b/typescript/ccip-server/Dockerfile @@ -8,6 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Install Foundry (Linux binaries) - pinned version for reproducibility ARG FOUNDRY_VERSION +ARG SERVICE_VERSION=dev ARG TARGETARCH SHELL ["/bin/bash", "-c"] RUN set -o pipefail && \ @@ -93,9 +94,11 @@ COPY --from=builder /app ./ COPY --from=builder /hyperlane-monorepo/typescript/ccip-server/prisma ./prisma # Environment variables +ARG SERVICE_VERSION=dev ENV NODE_ENV=production ENV LOG_LEVEL=info ENV SERVER_PORT=3000 +ENV SERVICE_VERSION=${SERVICE_VERSION} # Expose ports EXPOSE 3000 diff --git a/typescript/ccip-server/src/server.ts b/typescript/ccip-server/src/server.ts index a7a21d9b5f8..1fc310f81d0 100644 --- a/typescript/ccip-server/src/server.ts +++ b/typescript/ccip-server/src/server.ts @@ -4,8 +4,6 @@ import { pinoHttp } from 'pino-http'; import { createServiceLogger } from '@hyperlane-xyz/utils'; -import packageJson from '../package.json' with { type: 'json' }; - import { getEnabledModules } from './config.js'; import { ServiceFactory } from './services/BaseService.js'; import { CCTPService } from './services/CCTPService.js'; @@ -25,10 +23,12 @@ export const moduleRegistry: Record = { }; async function startServer() { + const VERSION = process.env.SERVICE_VERSION || 'dev'; + // Initialize logger first thing in startup const logger = await createServiceLogger({ service: 'ccip-server', - version: packageJson.version, + version: VERSION, }); const app = express();