From 112cc1c4dc482d359e50420a5a32f397a6db7e30 Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Tue, 26 May 2026 11:28:10 +0330 Subject: [PATCH] add docker-compose --- Dockerfile | 8 ++++++++ docker-compose.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile index ecac1e5..b2fb8e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,14 @@ RUN apk add --no-cache tzdata RUN cp /usr/share/zoneinfo/Asia/Tehran /etc/localtime && echo "Asia/Tehran" > /etc/timezone WORKDIR /build + +ARG VITE_API_URL +ARG VITE_TOKEN_NAME=dpage-editor-t +ARG VITE_REFRESH_TOKEN_NAME=dpage-editor-refresh-t +ENV VITE_API_URL=$VITE_API_URL \ + VITE_TOKEN_NAME=$VITE_TOKEN_NAME \ + VITE_REFRESH_TOKEN_NAME=$VITE_REFRESH_TOKEN_NAME + COPY package*.json ./ RUN npm ci --legacy-peer-deps COPY . ./ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..c4a4cd2 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,40 @@ +# ===================================== +# Production Docker Compose — dpage-editor +# ===================================== +# Vite SPA (static) served by nginx on port 80 +# Build context: repository root (parent of this file) +# ===================================== + +services: + + app: + build: + context: .. + dockerfile: Dockerfile + args: + - VITE_API_URL=${VITE_API_URL} + - VITE_TOKEN_NAME=${VITE_TOKEN_NAME:-dpage-editor-t} + - VITE_REFRESH_TOKEN_NAME=${VITE_REFRESH_TOKEN_NAME:-dpage-editor-refresh-t} + container_name: ${SERVICE_NAME:-dpage-editor}-${ENVIRONMENT:-prod} + image: ${IMAGE_REPO:-ghcr.io/zmihamid/dpage-editor}:${TAG:-latest} + ports: + - "${APP_PORT_EXTERNAL:-8080}:80" + restart: on-failure:3 + healthcheck: + test: ["CMD-SHELL", "test -s /usr/share/nginx/html/index.html"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 30s + logging: + driver: "json-file" + options: + max-size: "50m" + max-file: "5" + networks: + - app-network + +networks: + app-network: + driver: bridge + name: ${NETWORK_NAME:-dpage-editor-network}