This commit is contained in:
root
2025-09-25 10:34:56 +00:00
5 changed files with 93 additions and 2 deletions
+1
View File
@@ -8,6 +8,7 @@ npm-debug.log
.idea
frontend/build
frontend/dist
backend/.env
backend/node_modules
frontend/node_modules
+13 -2
View File
@@ -1,3 +1,14 @@
node_modules/
dist/
node_modules
**/node_modules
npm-debug.log
.DS_Store
.git
.vscode
.idea
frontend/build
frontend/dist
backend/node_modules
backend/.env
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" # Host 5173 → Container 5173
environment:
PORTAINER_URL: "https://10.10.10.21:9443/"
PORTAINER_API_KEY: "ptr_ce3Wufxf+EKpqxc5ebcQjBkUMUoJmMpY3wGIvkgdxV0="
ENDPOINT_ID: "1"
restart: unless-stopped
+13
View File
@@ -0,0 +1,13 @@
version: '3.8'
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "4000:4000"
environment:
PORT: 4000
PORTAINER_URL: "https://your-portainer.example.com"
PORTAINER_API_KEY: "your_api_key_here"
restart: unless-stopped