This commit is contained in:
root
2025-09-25 10:28:45 +00:00
3 changed files with 67 additions and 3 deletions
+1 -3
View File
@@ -3,12 +3,10 @@ node_modules
npm-debug.log npm-debug.log
.DS_Store .DS_Store
.git .git
.env
.vscode .vscode
.idea .idea
frontend/build frontend/build
frontend/dist frontend/dist
backend/node_modules backend/node_modules
backend/.env
frontend/node_modules frontend/node_modules
docker-compose.dev.yml
scripts/docker-release.sh
+53
View File
@@ -0,0 +1,53 @@
# ===============================
# Stage 1: Frontend Build
# ===============================
FROM node:20-alpine AS frontend-build
# Arbeitsverzeichnis
WORKDIR /app/frontend
# Nur package.json & package-lock.json kopieren und Dependencies installieren
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
# Restliche Frontend-Dateien kopieren
COPY frontend/ ./
# Frontend Build erzeugen (statische Dateien)
RUN npm run build
# ===============================
# Stage 2: Backend + Frontend
# ===============================
FROM node:20-alpine AS runtime
# Arbeitsverzeichnis
WORKDIR /app/backend
# Backend Dependencies installieren
COPY backend/package.json backend/package-lock.json ./
RUN npm ci --only=production
# Backend-Code kopieren
COPY backend/ ./
# public leeren
RUN rm -rf ./public/*
# Inhalt von dist inklusive Unterordner direkt nach public kopieren
COPY --from=frontend-build /app/frontend/dist/. ./public/
# Environment
ENV NODE_ENV=production
# Ports
# Backend intern: 4001
# Frontend exposed: 5173
EXPOSE 5173
# Node User
USER node
# Container startet das Backend (liefert statisches Frontend)
CMD ["node", "index.js"]
+13
View File
@@ -0,0 +1,13 @@
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "4001:4001"
environment:
PORTAINER_URL: "Your_Portainer_Server_Address"
PORTAINER_API_KEY: "Your_Portainer_API_Key"
PORTAINER_ENDPOINT_ID: "Your_Portainer_Endpoint_ID"
restart: unless-stopped