From 648777c6497b6247021452ce9e453a1b88a3dba9 Mon Sep 17 00:00:00 2001 From: Darian Date: Thu, 24 Sep 2026 15:11:37 +0330 Subject: [PATCH] Refactor Dockerfile and GitHub Actions workflow for improved build performance. Removed caching for npm installs, disabled BuildKit in the workflow, and streamlined the Docker build command. --- .github/workflows/deploy.yml | 10 +++------- Dockerfile | 6 +----- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c15775d..9d1a38b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,8 +13,8 @@ env: NETWORK_NAME: shared_web_network # Public hostname (Nginx Proxy Manager → this container:3000) PUBLIC_HOST: aut.insaight.net - DOCKER_BUILDKIT: "1" - COMPOSE_DOCKER_CLI_BUILD: "1" + # Self-hosted runner has no docker-buildx; force classic builder + DOCKER_BUILDKIT: "0" jobs: deploy: @@ -31,11 +31,7 @@ jobs: || docker network create "$NETWORK_NAME" - name: Build image - run: | - docker build \ - --progress=plain \ - -t "$IMAGE_NAME" \ - . + run: docker build -t "$IMAGE_NAME" . - name: Restart container env: diff --git a/Dockerfile b/Dockerfile index 9d0b4d6..db88d0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,8 @@ -# syntax=docker/dockerfile:1 - # ---- Dependencies ---- FROM node:22-alpine AS deps WORKDIR /app COPY package.json package-lock.json ./ -RUN --mount=type=cache,target=/root/.npm \ - npm ci +RUN npm ci # ---- Builder ---- FROM node:22-alpine AS builder @@ -13,7 +10,6 @@ WORKDIR /app ENV NEXT_TELEMETRY_DISABLED=1 # Skip React Compiler in image builds (big CPU/RAM cost on self-hosted runners) ENV DISABLE_REACT_COMPILER=1 -# Cap parallelism a bit so Turbopack/webpack don't thrash low-RAM hosts ENV NODE_OPTIONS=--max-old-space-size=3072 COPY --from=deps /app/node_modules ./node_modules COPY . .