deploy: canlı veri backend'ini container'a ekle (nginx /api → Node :3001)
- 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
This commit is contained in:
+17
-5
@@ -1,4 +1,4 @@
|
||||
# Stage 1: Build Vite SPA
|
||||
# Stage 1: Vite SPA build
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /app
|
||||
COPY package*.json ./
|
||||
@@ -6,9 +6,21 @@ RUN npm ci
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Production Nginx Server
|
||||
FROM nginx:alpine
|
||||
# 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/conf.d/default.conf
|
||||
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 ["nginx", "-g", "daemon off;"]
|
||||
CMD ["/start.sh"]
|
||||
|
||||
Reference in New Issue
Block a user