diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..37a07e9
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,31 @@
+# Version control
+.git
+.gitignore
+
+# Dependencies
+**/node_modules
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Next.js build output
+**/.next/
+**/out/
+
+# Medusa build output & cache
+**/.medusa/
+**/.cache/
+
+# Local environment files (do NOT bake local secrets into images)
+**/.env
+**/.env.local
+**/.env.development.local
+**/.env.test.local
+**/.env.production.local
+
+# Turbo cache
+**/.turbo
+
+# OS metadata
+.DS_Store
+Thumbs.db
diff --git a/.env.production.example b/.env.production.example
new file mode 100644
index 0000000..22cbc1f
--- /dev/null
+++ b/.env.production.example
@@ -0,0 +1,34 @@
+# ========================================================
+# SUMAN D.O.O. — DOCKER PRODUKCIJSKE VARIJABLE OKRUŽENJA
+# ========================================================
+# Kopirajte ovaj fajl u .env.production ili .env na serveru:
+# cp .env.production.example .env
+
+# --- POSTGRESQL BAZA ---
+POSTGRES_USER=suman_prod_user
+POSTGRES_PASSWORD=PostaviSigurnuLozinkuBaze123!
+POSTGRES_DB=suman_prod_db
+
+# --- REDIS CACHE ---
+REDIS_PASSWORD=PostaviSigurnuLozinkuRedis123!
+
+# --- MEDUSA V2 BACKEND ---
+BACKEND_PORT=9000
+JWT_SECRET=generisi_siguran_jwt_secret_najmanje_32_karaktera
+COOKIE_SECRET=generisi_siguran_cookie_secret_najmanje_32_karaktera
+MEDUSA_BACKEND_URL=https://api.suman.ba
+
+# CORS Konfiguracija (odvojeno zarezima)
+STORE_CORS=https://suman.ba,https://suman.hr,http://localhost:8000,http://localhost:8002
+ADMIN_CORS=https://admin.suman.ba,http://localhost:9000
+AUTH_CORS=https://admin.suman.ba,https://suman.ba,https://suman.hr,http://localhost:9000,http://localhost:8000,http://localhost:8002
+
+# --- STOREFRONT BOSNA I HERCEGOVINA ---
+STOREFRONT_BA_PORT=8000
+STOREFRONT_BA_BASE_URL=https://suman.ba
+MEDUSA_PUBLISHABLE_KEY_BA=pk_b722e44870bc8cc7828d0713980537e95b2e74ff229a529a4b3fa8155035f1f0
+
+# --- STOREFRONT HRVATSKA ---
+STOREFRONT_HR_PORT=8002
+STOREFRONT_HR_BASE_URL=https://suman.hr
+MEDUSA_PUBLISHABLE_KEY_HR=pk_suman_hrvatska_publishable_key
diff --git a/apps/backend/Dockerfile b/apps/backend/Dockerfile
new file mode 100644
index 0000000..7021373
--- /dev/null
+++ b/apps/backend/Dockerfile
@@ -0,0 +1,54 @@
+# ==========================================
+# Medusa v2 Production Dockerfile
+# ==========================================
+
+# 1. Base stage with dependencies
+FROM node:22-alpine AS base
+WORKDIR /app
+RUN apk add --no-cache libc6-compat
+
+# Copy root workspace manifests
+COPY package.json package-lock.json ./
+COPY apps/backend/package.json ./apps/backend/
+COPY apps/suman-bosna/package.json ./apps/suman-bosna/
+COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
+
+# Install dependencies for backend workspace
+RUN npm ci --workspace=@dtc/backend --include-workspace-root
+
+# 2. Build stage
+FROM base AS builder
+WORKDIR /app
+
+COPY apps/backend ./apps/backend
+
+ENV NODE_ENV=production
+RUN npm run build --workspace=@dtc/backend
+
+# 3. Production runner stage
+FROM node:22-alpine AS runner
+WORKDIR /app/apps/backend
+
+RUN apk add --no-cache libc6-compat curl
+
+ENV NODE_ENV=production
+ENV PORT=9000
+
+# Non-root user
+RUN addgroup --system --gid 1001 nodejs && \
+ adduser --system --uid 1001 medusa
+
+# Copy dependencies and compiled server artifacts
+COPY --from=base --chown=medusa:nodejs /app/node_modules /app/node_modules
+COPY --from=base --chown=medusa:nodejs /app/package.json /app/package-lock.json /app/
+COPY --from=builder --chown=medusa:nodejs /app/apps/backend /app/apps/backend
+
+# Uploads directory
+RUN mkdir -p /app/apps/backend/uploads && chown -R medusa:nodejs /app/apps/backend/uploads
+
+USER medusa
+
+EXPOSE 9000
+
+# Run migrations and start Medusa production server
+CMD ["sh", "-c", "npx medusa db:migrate && npm run start"]
diff --git a/apps/backend/tsconfig.json b/apps/backend/tsconfig.json
index 12823ae..dacab8e 100644
--- a/apps/backend/tsconfig.json
+++ b/apps/backend/tsconfig.json
@@ -32,5 +32,6 @@
".medusa/admin",
".cache",
"eslint.config.*",
+ "src/scripts"
]
}
diff --git a/apps/suman-bosna/Dockerfile b/apps/suman-bosna/Dockerfile
new file mode 100644
index 0000000..29d1cfd
--- /dev/null
+++ b/apps/suman-bosna/Dockerfile
@@ -0,0 +1,56 @@
+# ==========================================
+# Next.js 16 Storefront Production Dockerfile (Suman Bosna)
+# ==========================================
+
+# 1. Base stage with dependencies
+FROM node:22-alpine AS base
+WORKDIR /app
+RUN apk add --no-cache libc6-compat
+
+COPY package.json package-lock.json ./
+COPY apps/backend/package.json ./apps/backend/
+COPY apps/suman-bosna/package.json ./apps/suman-bosna/
+COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
+
+RUN npm ci --workspace=@dtc/suman-bosna --include-workspace-root
+
+# 2. Build stage
+FROM base AS builder
+WORKDIR /app
+
+COPY apps/suman-bosna ./apps/suman-bosna
+
+ARG NEXT_PUBLIC_MEDUSA_BACKEND_URL
+ARG NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
+ARG NEXT_PUBLIC_BASE_URL
+ARG NEXT_PUBLIC_DEFAULT_REGION=ba
+
+ENV NEXT_PUBLIC_MEDUSA_BACKEND_URL=$NEXT_PUBLIC_MEDUSA_BACKEND_URL
+ENV NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=$NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
+ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL
+ENV NEXT_PUBLIC_DEFAULT_REGION=$NEXT_PUBLIC_DEFAULT_REGION
+ENV NODE_ENV=production
+
+RUN npm run build --workspace=@dtc/suman-bosna
+
+# 3. Production runner stage
+FROM node:22-alpine AS runner
+WORKDIR /app/apps/suman-bosna
+
+RUN apk add --no-cache libc6-compat curl
+
+ENV NODE_ENV=production
+ENV PORT=8000
+
+RUN addgroup --system --gid 1001 nodejs && \
+ adduser --system --uid 1001 nextjs
+
+COPY --from=base --chown=nextjs:nodejs /app/node_modules /app/node_modules
+COPY --from=base --chown=nextjs:nodejs /app/package.json /app/package-lock.json /app/
+COPY --from=builder --chown=nextjs:nodejs /app/apps/suman-bosna /app/apps/suman-bosna
+
+USER nextjs
+
+EXPOSE 8000
+
+CMD ["npm", "run", "start"]
diff --git a/apps/suman-bosna/next-env.d.ts b/apps/suman-bosna/next-env.d.ts
index a419cbe..ce4e94a 100644
--- a/apps/suman-bosna/next-env.d.ts
+++ b/apps/suman-bosna/next-env.d.ts
@@ -1,7 +1,7 @@
///
///
-import "./.next/dev/types/routes.d.ts";
-import "./.next/dev/types/root-params.d.ts";
+import "./.next/types/routes.d.ts";
+import "./.next/types/root-params.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/apps/suman-hrvatska/Dockerfile b/apps/suman-hrvatska/Dockerfile
new file mode 100644
index 0000000..4cb2368
--- /dev/null
+++ b/apps/suman-hrvatska/Dockerfile
@@ -0,0 +1,56 @@
+# ==========================================
+# Next.js 16 Storefront Production Dockerfile (Suman Hrvatska)
+# ==========================================
+
+# 1. Base stage with dependencies
+FROM node:22-alpine AS base
+WORKDIR /app
+RUN apk add --no-cache libc6-compat
+
+COPY package.json package-lock.json ./
+COPY apps/backend/package.json ./apps/backend/
+COPY apps/suman-bosna/package.json ./apps/suman-bosna/
+COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
+
+RUN npm ci --workspace=@dtc/suman-hrvatska --include-workspace-root
+
+# 2. Build stage
+FROM base AS builder
+WORKDIR /app
+
+COPY apps/suman-hrvatska ./apps/suman-hrvatska
+
+ARG NEXT_PUBLIC_MEDUSA_BACKEND_URL
+ARG NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
+ARG NEXT_PUBLIC_BASE_URL
+ARG NEXT_PUBLIC_DEFAULT_REGION=hr
+
+ENV NEXT_PUBLIC_MEDUSA_BACKEND_URL=$NEXT_PUBLIC_MEDUSA_BACKEND_URL
+ENV NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=$NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
+ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL
+ENV NEXT_PUBLIC_DEFAULT_REGION=$NEXT_PUBLIC_DEFAULT_REGION
+ENV NODE_ENV=production
+
+RUN npm run build --workspace=@dtc/suman-hrvatska
+
+# 3. Production runner stage
+FROM node:22-alpine AS runner
+WORKDIR /app/apps/suman-hrvatska
+
+RUN apk add --no-cache libc6-compat curl
+
+ENV NODE_ENV=production
+ENV PORT=8002
+
+RUN addgroup --system --gid 1001 nodejs && \
+ adduser --system --uid 1001 nextjs
+
+COPY --from=base --chown=nextjs:nodejs /app/node_modules /app/node_modules
+COPY --from=base --chown=nextjs:nodejs /app/package.json /app/package-lock.json /app/
+COPY --from=builder --chown=nextjs:nodejs /app/apps/suman-hrvatska /app/apps/suman-hrvatska
+
+USER nextjs
+
+EXPOSE 8002
+
+CMD ["npm", "run", "start"]
diff --git a/apps/suman-hrvatska/next-env.d.ts b/apps/suman-hrvatska/next-env.d.ts
index a419cbe..ce4e94a 100644
--- a/apps/suman-hrvatska/next-env.d.ts
+++ b/apps/suman-hrvatska/next-env.d.ts
@@ -1,7 +1,7 @@
///
///
-import "./.next/dev/types/routes.d.ts";
-import "./.next/dev/types/root-params.d.ts";
+import "./.next/types/routes.d.ts";
+import "./.next/types/root-params.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/docker-compose.local.yml b/docker-compose.local.yml
new file mode 100644
index 0000000..3ea7f2a
--- /dev/null
+++ b/docker-compose.local.yml
@@ -0,0 +1,38 @@
+name: suman-local
+
+services:
+ postgres:
+ image: postgres:16-alpine
+ container_name: umbrella_postgres
+ restart: unless-stopped
+ environment:
+ POSTGRES_USER: ${POSTGRES_USER:-suman_user}
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-TvojaSigurnaLozinka123!}
+ POSTGRES_DB: ${POSTGRES_DB:-medusa-suman-doo}
+ ports:
+ - "5432:5432"
+ volumes:
+ - pgdata:/var/lib/postgresql/data
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-suman_user} -d ${POSTGRES_DB:-medusa-suman-doo}"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+ redis:
+ image: redis:7-alpine
+ container_name: umbrella-redis
+ restart: unless-stopped
+ ports:
+ - "6379:6379"
+ volumes:
+ - redisdata:/data
+ healthcheck:
+ test: ["CMD", "redis-cli", "ping"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+
+volumes:
+ pgdata:
+ redisdata:
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
new file mode 100644
index 0000000..13b97c6
--- /dev/null
+++ b/docker-compose.prod.yml
@@ -0,0 +1,178 @@
+name: suman-prod
+
+services:
+ # ==========================================
+ # 1. PostgreSQL Baza Podataka
+ # ==========================================
+ postgres:
+ image: postgres:16-alpine
+ container_name: suman_prod_postgres
+ restart: always
+ environment:
+ POSTGRES_USER: ${POSTGRES_USER:-suman_prod_user}
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-suman_prod_secure_pass_123}
+ POSTGRES_DB: ${POSTGRES_DB:-suman_prod_db}
+ volumes:
+ - postgres_data:/var/lib/postgresql/data
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-suman_prod_user} -d ${POSTGRES_DB:-suman_prod_db}"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+ networks:
+ - suman_network
+
+ # ==========================================
+ # 2. Redis Cache & Queue
+ # ==========================================
+ redis:
+ image: redis:7-alpine
+ container_name: suman_prod_redis
+ restart: always
+ command: >
+ sh -c '
+ if [ -n "$$REDIS_PASSWORD" ]; then
+ redis-server --appendonly yes --requirepass "$$REDIS_PASSWORD"
+ else
+ redis-server --appendonly yes
+ fi
+ '
+ environment:
+ REDIS_PASSWORD: ${REDIS_PASSWORD:-}
+ volumes:
+ - redis_data:/data
+ healthcheck:
+ test: >
+ sh -c '
+ if [ -n "$$REDIS_PASSWORD" ]; then
+ redis-cli -a "$$REDIS_PASSWORD" ping
+ else
+ redis-cli ping
+ fi
+ '
+ interval: 10s
+ timeout: 5s
+ retries: 5
+ networks:
+ - suman_network
+
+ # ==========================================
+ # 3. Medusa v2 Backend (API & Admin)
+ # ==========================================
+ backend:
+ build:
+ context: .
+ dockerfile: apps/backend/Dockerfile
+ container_name: suman_prod_backend
+ restart: always
+ depends_on:
+ postgres:
+ condition: service_healthy
+ redis:
+ condition: service_healthy
+ environment:
+ NODE_ENV: production
+ PORT: 9000
+ DATABASE_URL: postgres://${POSTGRES_USER:-suman_prod_user}:${POSTGRES_PASSWORD:-suman_prod_secure_pass_123}@postgres:5432/${POSTGRES_DB:-suman_prod_db}
+ REDIS_URL: redis://${REDIS_PASSWORD:+:${REDIS_PASSWORD}@}redis:6379
+ JWT_SECRET: ${JWT_SECRET:-suman_prod_super_secret_jwt_key_32_chars_min}
+ COOKIE_SECRET: ${COOKIE_SECRET:-suman_prod_super_secret_cookie_key_32_chars}
+ STORE_CORS: ${STORE_CORS:-http://localhost:8000,http://localhost:8002,https://suman.ba,https://suman.hr}
+ ADMIN_CORS: ${ADMIN_CORS:-http://localhost:9000,https://admin.suman.ba,https://suman.ba}
+ AUTH_CORS: ${AUTH_CORS:-http://localhost:9000,http://localhost:8000,http://localhost:8002,https://suman.ba,https://suman.hr}
+ MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://localhost:9000}
+ volumes:
+ - backend_uploads:/app/apps/backend/uploads
+ ports:
+ - "${BACKEND_PORT:-9000}:9000"
+ healthcheck:
+ test: ["CMD-SHELL", "curl -f http://localhost:9000/health || exit 1"]
+ interval: 15s
+ timeout: 5s
+ retries: 5
+ start_period: 20s
+ networks:
+ - suman_network
+
+ # ==========================================
+ # 4. Storefront Bosna i Hercegovina (Next.js)
+ # ==========================================
+ storefront-bosna:
+ build:
+ context: .
+ dockerfile: apps/suman-bosna/Dockerfile
+ args:
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_BA:-}
+ NEXT_PUBLIC_BASE_URL: ${STOREFRONT_BA_BASE_URL:-http://localhost:8000}
+ NEXT_PUBLIC_DEFAULT_REGION: ba
+ container_name: suman_prod_storefront_bosna
+ restart: always
+ depends_on:
+ backend:
+ condition: service_healthy
+ environment:
+ NODE_ENV: production
+ PORT: 8000
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_BA:-}
+ NEXT_PUBLIC_BASE_URL: ${STOREFRONT_BA_BASE_URL:-http://localhost:8000}
+ NEXT_PUBLIC_DEFAULT_REGION: ba
+ ports:
+ - "${STOREFRONT_BA_PORT:-8000}:8000"
+ healthcheck:
+ test: ["CMD-SHELL", "curl -f http://localhost:8000/ || exit 1"]
+ interval: 15s
+ timeout: 5s
+ retries: 5
+ start_period: 15s
+ networks:
+ - suman_network
+
+ # ==========================================
+ # 5. Storefront Hrvatska (Next.js)
+ # ==========================================
+ storefront-hrvatska:
+ build:
+ context: .
+ dockerfile: apps/suman-hrvatska/Dockerfile
+ args:
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_HR:-}
+ NEXT_PUBLIC_BASE_URL: ${STOREFRONT_HR_BASE_URL:-http://localhost:8002}
+ NEXT_PUBLIC_DEFAULT_REGION: hr
+ container_name: suman_prod_storefront_hrvatska
+ restart: always
+ depends_on:
+ backend:
+ condition: service_healthy
+ environment:
+ NODE_ENV: production
+ PORT: 8002
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_HR:-}
+ NEXT_PUBLIC_BASE_URL: ${STOREFRONT_HR_BASE_URL:-http://localhost:8002}
+ NEXT_PUBLIC_DEFAULT_REGION: hr
+ ports:
+ - "${STOREFRONT_HR_PORT:-8002}:8002"
+ healthcheck:
+ test: ["CMD-SHELL", "curl -f http://localhost:8002/ || exit 1"]
+ interval: 15s
+ timeout: 5s
+ retries: 5
+ start_period: 15s
+ networks:
+ - suman_network
+
+volumes:
+ postgres_data:
+ name: suman_prod_pgdata
+ redis_data:
+ name: suman_prod_redisdata
+ backend_uploads:
+ name: suman_prod_uploads
+
+networks:
+ suman_network:
+ name: suman_prod_network
+ driver: bridge
diff --git a/docker-compose.yml b/docker-compose.yml
index 7278bba..13b97c6 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,29 +1,178 @@
-version: "3.8"
+name: suman-prod
services:
+ # ==========================================
+ # 1. PostgreSQL Baza Podataka
+ # ==========================================
postgres:
image: postgres:16-alpine
- container_name: umbrella_postgres
- restart: unless-stopped
+ container_name: suman_prod_postgres
+ restart: always
environment:
- POSTGRES_USER: ${POSTGRES_USER:-suman_user}
- POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-TvojaSigurnaLozinka123!}
- POSTGRES_DB: ${POSTGRES_DB:-medusa-suman-doo}
- ports:
- - "5432:5432"
+ POSTGRES_USER: ${POSTGRES_USER:-suman_prod_user}
+ POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-suman_prod_secure_pass_123}
+ POSTGRES_DB: ${POSTGRES_DB:-suman_prod_db}
volumes:
- - pgdata:/var/lib/postgresql/data
+ - postgres_data:/var/lib/postgresql/data
+ healthcheck:
+ test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-suman_prod_user} -d ${POSTGRES_DB:-suman_prod_db}"]
+ interval: 10s
+ timeout: 5s
+ retries: 5
+ networks:
+ - suman_network
+ # ==========================================
+ # 2. Redis Cache & Queue
+ # ==========================================
redis:
image: redis:7-alpine
- container_name: umbrella-redis
- restart: unless-stopped
- ports:
- - "6379:6379"
+ container_name: suman_prod_redis
+ restart: always
+ command: >
+ sh -c '
+ if [ -n "$$REDIS_PASSWORD" ]; then
+ redis-server --appendonly yes --requirepass "$$REDIS_PASSWORD"
+ else
+ redis-server --appendonly yes
+ fi
+ '
+ environment:
+ REDIS_PASSWORD: ${REDIS_PASSWORD:-}
volumes:
- - redisdata:/data
+ - redis_data:/data
+ healthcheck:
+ test: >
+ sh -c '
+ if [ -n "$$REDIS_PASSWORD" ]; then
+ redis-cli -a "$$REDIS_PASSWORD" ping
+ else
+ redis-cli ping
+ fi
+ '
+ interval: 10s
+ timeout: 5s
+ retries: 5
+ networks:
+ - suman_network
+
+ # ==========================================
+ # 3. Medusa v2 Backend (API & Admin)
+ # ==========================================
+ backend:
+ build:
+ context: .
+ dockerfile: apps/backend/Dockerfile
+ container_name: suman_prod_backend
+ restart: always
+ depends_on:
+ postgres:
+ condition: service_healthy
+ redis:
+ condition: service_healthy
+ environment:
+ NODE_ENV: production
+ PORT: 9000
+ DATABASE_URL: postgres://${POSTGRES_USER:-suman_prod_user}:${POSTGRES_PASSWORD:-suman_prod_secure_pass_123}@postgres:5432/${POSTGRES_DB:-suman_prod_db}
+ REDIS_URL: redis://${REDIS_PASSWORD:+:${REDIS_PASSWORD}@}redis:6379
+ JWT_SECRET: ${JWT_SECRET:-suman_prod_super_secret_jwt_key_32_chars_min}
+ COOKIE_SECRET: ${COOKIE_SECRET:-suman_prod_super_secret_cookie_key_32_chars}
+ STORE_CORS: ${STORE_CORS:-http://localhost:8000,http://localhost:8002,https://suman.ba,https://suman.hr}
+ ADMIN_CORS: ${ADMIN_CORS:-http://localhost:9000,https://admin.suman.ba,https://suman.ba}
+ AUTH_CORS: ${AUTH_CORS:-http://localhost:9000,http://localhost:8000,http://localhost:8002,https://suman.ba,https://suman.hr}
+ MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://localhost:9000}
+ volumes:
+ - backend_uploads:/app/apps/backend/uploads
+ ports:
+ - "${BACKEND_PORT:-9000}:9000"
+ healthcheck:
+ test: ["CMD-SHELL", "curl -f http://localhost:9000/health || exit 1"]
+ interval: 15s
+ timeout: 5s
+ retries: 5
+ start_period: 20s
+ networks:
+ - suman_network
+
+ # ==========================================
+ # 4. Storefront Bosna i Hercegovina (Next.js)
+ # ==========================================
+ storefront-bosna:
+ build:
+ context: .
+ dockerfile: apps/suman-bosna/Dockerfile
+ args:
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_BA:-}
+ NEXT_PUBLIC_BASE_URL: ${STOREFRONT_BA_BASE_URL:-http://localhost:8000}
+ NEXT_PUBLIC_DEFAULT_REGION: ba
+ container_name: suman_prod_storefront_bosna
+ restart: always
+ depends_on:
+ backend:
+ condition: service_healthy
+ environment:
+ NODE_ENV: production
+ PORT: 8000
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_BA:-}
+ NEXT_PUBLIC_BASE_URL: ${STOREFRONT_BA_BASE_URL:-http://localhost:8000}
+ NEXT_PUBLIC_DEFAULT_REGION: ba
+ ports:
+ - "${STOREFRONT_BA_PORT:-8000}:8000"
+ healthcheck:
+ test: ["CMD-SHELL", "curl -f http://localhost:8000/ || exit 1"]
+ interval: 15s
+ timeout: 5s
+ retries: 5
+ start_period: 15s
+ networks:
+ - suman_network
+
+ # ==========================================
+ # 5. Storefront Hrvatska (Next.js)
+ # ==========================================
+ storefront-hrvatska:
+ build:
+ context: .
+ dockerfile: apps/suman-hrvatska/Dockerfile
+ args:
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_HR:-}
+ NEXT_PUBLIC_BASE_URL: ${STOREFRONT_HR_BASE_URL:-http://localhost:8002}
+ NEXT_PUBLIC_DEFAULT_REGION: hr
+ container_name: suman_prod_storefront_hrvatska
+ restart: always
+ depends_on:
+ backend:
+ condition: service_healthy
+ environment:
+ NODE_ENV: production
+ PORT: 8002
+ NEXT_PUBLIC_MEDUSA_BACKEND_URL: ${MEDUSA_BACKEND_URL:-http://backend:9000}
+ NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY: ${MEDUSA_PUBLISHABLE_KEY_HR:-}
+ NEXT_PUBLIC_BASE_URL: ${STOREFRONT_HR_BASE_URL:-http://localhost:8002}
+ NEXT_PUBLIC_DEFAULT_REGION: hr
+ ports:
+ - "${STOREFRONT_HR_PORT:-8002}:8002"
+ healthcheck:
+ test: ["CMD-SHELL", "curl -f http://localhost:8002/ || exit 1"]
+ interval: 15s
+ timeout: 5s
+ retries: 5
+ start_period: 15s
+ networks:
+ - suman_network
volumes:
- pgdata:
- redisdata:
+ postgres_data:
+ name: suman_prod_pgdata
+ redis_data:
+ name: suman_prod_redisdata
+ backend_uploads:
+ name: suman_prod_uploads
+networks:
+ suman_network:
+ name: suman_prod_network
+ driver: bridge
diff --git a/package.json b/package.json
index d029ca2..5491902 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,12 @@
"backend:dev": "turbo dev --filter=@dtc/backend",
"storefront:dev": "turbo dev --filter=@dtc/suman-bosna",
"suman-bosna:dev": "turbo dev --filter=@dtc/suman-bosna",
- "suman-hrvatska:dev": "turbo dev --filter=@dtc/suman-hrvatska"
+ "suman-hrvatska:dev": "turbo dev --filter=@dtc/suman-hrvatska",
+ "docker:local": "docker compose -f docker-compose.local.yml up -d",
+ "docker:local:down": "docker compose -f docker-compose.local.yml down",
+ "docker:prod:build": "docker compose build",
+ "docker:prod:up": "docker compose up -d",
+ "docker:prod:down": "docker compose down"
},
"pnpm": {
"overrides": {