- Dockerfile: nginx + Node tek container; backend arka planda, nginx ön planda - nginx.conf: /api → 127.0.0.1:3001 proxy - dt-store: node:sqlite guard (yoksa DT devre dışı, açık ihaleler yine canlı) - Açık ihale canlı verisi sıfır npm bağımlılığıyla deploy'da çalışır
27 lines
742 B
Docker
27 lines
742 B
Docker
# Stage 1: Vite SPA build
|
||
FROM node:22-alpine AS build
|
||
WORKDIR /app
|
||
COPY package*.json ./
|
||
RUN npm ci
|
||
COPY . .
|
||
RUN npm run build
|
||
|
||
# Stage 2: nginx (frontend) + node (canlı veri backend) tek container'da
|
||
FROM node:22-alpine
|
||
RUN apk add --no-cache nginx
|
||
|
||
# Frontend
|
||
COPY --from=build /app/dist /usr/share/nginx/html
|
||
COPY --from=build /app/nginx.conf /etc/nginx/http.d/default.conf
|
||
|
||
# Backend (yalnızca Node builtin'leri kullanır — npm bağımlılığı yok)
|
||
WORKDIR /app
|
||
COPY --from=build /app/server ./server
|
||
|
||
# Başlangıç: Node backend'i (3001) arka planda + nginx ön planda
|
||
RUN printf '#!/bin/sh\nset -e\nnode /app/server/index.js &\nexec nginx -g "daemon off;"\n' > /start.sh \
|
||
&& chmod +x /start.sh
|
||
|
||
EXPOSE 80
|
||
CMD ["/start.sh"]
|