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.

This commit is contained in:
smhk1376 committed 2026-09-24 15:11:37 +03:30
1 parent f585a5e35e
commit 648777c649
2 files changed
+4 -12

No files matched your search

+3 -7
View File
@@ -13,8 +13,8 @@ env:
NETWORK_NAME: shared_web_network NETWORK_NAME: shared_web_network
# Public hostname (Nginx Proxy Manager → this container:3000) # Public hostname (Nginx Proxy Manager → this container:3000)
PUBLIC_HOST: aut.insaight.net PUBLIC_HOST: aut.insaight.net
DOCKER_BUILDKIT: "1" # Self-hosted runner has no docker-buildx; force classic builder
COMPOSE_DOCKER_CLI_BUILD: "1" DOCKER_BUILDKIT: "0"
jobs: jobs:
deploy: deploy:
@@ -31,11 +31,7 @@ jobs:
|| docker network create "$NETWORK_NAME" || docker network create "$NETWORK_NAME"
- name: Build image - name: Build image
run: | run: docker build -t "$IMAGE_NAME" .
docker build \
--progress=plain \
-t "$IMAGE_NAME" \
.
- name: Restart container - name: Restart container
env: env:
+1 -5
View File
@@ -1,11 +1,8 @@
# syntax=docker/dockerfile:1
# ---- Dependencies ---- # ---- Dependencies ----
FROM node:22-alpine AS deps FROM node:22-alpine AS deps
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json ./ COPY package.json package-lock.json ./
RUN --mount=type=cache,target=/root/.npm \ RUN npm ci
npm ci
# ---- Builder ---- # ---- Builder ----
FROM node:22-alpine AS builder FROM node:22-alpine AS builder
@@ -13,7 +10,6 @@ WORKDIR /app
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
# Skip React Compiler in image builds (big CPU/RAM cost on self-hosted runners) # Skip React Compiler in image builds (big CPU/RAM cost on self-hosted runners)
ENV DISABLE_REACT_COMPILER=1 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 ENV NODE_OPTIONS=--max-old-space-size=3072
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .