From 8635ab431bbd211f23482f61f50fec9a100eaa98 Mon Sep 17 00:00:00 2001 From: morteza-mortezai Date: Sat, 6 Jun 2026 09:56:01 +0330 Subject: [PATCH] optimize docker --- .dockerignore | 11 +++++++++++ Dockerfile | 14 ++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) create mode 100644 .dockerignore diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..5c44ae7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +node_modules +dist +build +.git +coverage +.cache +.eslintcache +*.log +.env* +.idea +.vscode diff --git a/Dockerfile b/Dockerfile index 9c66677..cc74fb7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,17 @@ FROM node:22-alpine AS builder -# Install tzdata to support timezone settings -RUN apk add --no-cache tzdata - -# Set the timezone to Asia/Tehran -RUN cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && echo "Asia/Tehran" > /etc/timezone - WORKDIR /build + COPY package*.json ./ RUN npm ci --legacy-peer-deps + COPY . ./ RUN npm run build -FROM nginx:stable-alpine AS production-stage +FROM nginx:stable-alpine AS production COPY --from=builder /build/dist /usr/share/nginx/html - -COPY --from=builder /build/nginx.con[f] /etc/nginx/conf.d/default.conf -RUN cat /etc/nginx/conf.d/default.conf +COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80