diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 519d827..6697ffd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,8 +43,8 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push Docker image run: | - docker build --build-arg BUILD_VERSION=${{ needs.release.outputs.new-release-version }} VERSION=${{ needs.release.outputs.new-release-version }} \ - -t ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} \ + echo VERSION=${{ needs.release.outputs.new-release-version }} >> .env + docker build -t ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} \ -t ghcr.io/${{ github.repository }}:latest . docker push ghcr.io/${{ github.repository }}:latest docker push ghcr.io/${{ github.repository }}:${{ needs.release.outputs.new-release-version }} diff --git a/Dockerfile b/Dockerfile index 782e1f9..629fe2f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,6 +3,7 @@ # Install dependencies only when needed FROM node:18-alpine AS deps # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. + RUN apk add --no-cache libc6-compat WORKDIR /app COPY package.json ./ @@ -10,6 +11,7 @@ RUN npm install --frozen-lockfile # Rebuild the source code only when needed FROM node:18-alpine AS builder + WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . diff --git a/docker-compose.build.yml b/docker-compose.build.yml index 3c431eb..23e85e3 100644 --- a/docker-compose.build.yml +++ b/docker-compose.build.yml @@ -10,5 +10,3 @@ services: - "3000:3000" env_file: - .env - environment: - - BUILD_VERSION=${BUILD_VERSION} diff --git a/next.config.mjs b/next.config.mjs index ee15efb..65ab7b9 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,11 +1,5 @@ /** @type {import('next').NextConfig} */ -import { readFileSync } from 'fs'; - -const { version } = JSON.parse(readFileSync('./package.json', 'utf-8')); - -console.log(`Version: ${version}`); - const nextConfig = { reactStrictMode: false, output: 'standalone', @@ -13,7 +7,7 @@ const nextConfig = { unoptimized: true, }, env: { - VERSION: process.env.BUILD_VERSION || version, + VERSION: process.env.VERSION, }, };