diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 16cd44e..fc9e8e2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,6 +21,9 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Get version from package.json + run: echo "PACKAGE_VERSION=$(jq -r '.version' app/package.json)" >> $GITHUB_ENV + - name: Log in to GitHub Container Registry uses: docker/login-action@v3 with: @@ -47,6 +50,10 @@ jobs: file: Dockerfile push: true platforms: linux/amd64,linux/arm64,linux/arm/v7 + build-args: | + PACKAGE_VERSION=${{ env.PACKAGE_VERSION }} tags: | ${{ github.repository }}:latest + ${{ github.repository }}:${{ env.PACKAGE_VERSION }} ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ env.PACKAGE_VERSION }} diff --git a/Dockerfile b/Dockerfile index 0bf58ac..c2e7062 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,8 @@ USER node RUN npm install --omit=dev +ARG PACKAGE_VERSION +ENV APP_VERSION=${PACKAGE_VERSION} ENV NODE_ENV=production # Build without type checking, as we have removed the Typescript diff --git a/app/package.json b/app/package.json index ac380ad..d651891 100644 --- a/app/package.json +++ b/app/package.json @@ -4,7 +4,7 @@ "scripts": { "dev": "ts-node src/index.ts", "build": "npx tsc", - "test": "podman build --format docker -t immich-proxy-test .. && podman run --init -it -p=3000:3000 --env-file .env immich-proxy-test", + "test": "podman build --build-arg PACKAGE_VERSION=$(npm pkg get version | xargs) --format docker -t immich-proxy-test .. && podman run --init -it -p=3000:3000 --env-file .env immich-proxy-test", "start": "node dist/index.js" }, "author": "Alan Grainger",