ERNEUTER TEST
This commit is contained in:
42
Dockerfile
42
Dockerfile
@@ -1,42 +0,0 @@
|
|||||||
# Build-Phase für das Frontend
|
|
||||||
FROM node:latest AS frontend-build
|
|
||||||
WORKDIR /app
|
|
||||||
COPY ./frontend ./frontend
|
|
||||||
WORKDIR /app/frontend
|
|
||||||
RUN npm install
|
|
||||||
RUN npm run build
|
|
||||||
|
|
||||||
# Build-Phase für das Backend
|
|
||||||
FROM node:latest AS backend-build
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
COPY ./backend ./backend
|
|
||||||
WORKDIR /usr/src/app/backend
|
|
||||||
|
|
||||||
# TypeScript global installieren
|
|
||||||
RUN npm install -g typescript
|
|
||||||
|
|
||||||
# npm-Abhängigkeiten installieren und TypeScript kompilieren
|
|
||||||
RUN npm install
|
|
||||||
RUN tsc
|
|
||||||
|
|
||||||
# Produktionsphase
|
|
||||||
FROM nginx:latest
|
|
||||||
|
|
||||||
# Kopieren des React-Builds
|
|
||||||
COPY --from=frontend-build /app/frontend/build /var/www/html
|
|
||||||
|
|
||||||
# Node.js Umgebung für das Backend vorbereiten
|
|
||||||
WORKDIR /usr/src/app
|
|
||||||
|
|
||||||
# Backend-Quelldateien und kompilierte JavaScript-Dateien kopieren
|
|
||||||
COPY --from=backend-build /usr/src/app/backend /usr/src/app/backend
|
|
||||||
|
|
||||||
# Standard Nginx-Konfiguration überschreiben, falls notwendig
|
|
||||||
COPY default.conf /etc/nginx/conf.d/default.conf
|
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 80
|
|
||||||
|
|
||||||
|
|
||||||
# Startkommando
|
|
||||||
CMD sh -c "nginx -g 'daemon off;' & node backend/dist/index.js"
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "esnext",
|
|
||||||
"module": "commonjs",
|
|
||||||
"strict": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"outDir": "./dist",
|
|
||||||
"rootDir": "./src"
|
|
||||||
},
|
|
||||||
"include": ["src/**/*"],
|
|
||||||
"exclude": ["node_modules", "dist"]
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
version: "3.3"
|
|
||||||
services:
|
|
||||||
{{.DirName}}:
|
|
||||||
image: {{.DirName}}
|
|
||||||
container_name: {{.DirName}}_container
|
|
||||||
restart: unless-stopped
|
|
||||||
networks:
|
|
||||||
- Backend
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.routers.{{.DirName}}.rule=Host('{{.DirName}}.csnetworkx.dev')"
|
|
||||||
- "traefik.http.routers.{{.DirName}}.entrypoints=websecure"
|
|
||||||
- "traefik.http.services.{{.DirName}}.loadbalancer.server.port=80"
|
|
||||||
- "traefik.http.routers.{{.DirName}}.service={{.DirName}}"
|
|
||||||
- "traefik.http.routers.{{.DirName}}.tls.certresolver=acme"
|
|
||||||
networks:
|
|
||||||
Backend:
|
|
||||||
external: true
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
// Standard-Einstiegspunkt für die App
|
|
||||||
import express from 'express';
|
|
||||||
import dotenv from 'dotenv';
|
|
||||||
|
|
||||||
dotenv.config();
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
const NODE_ENV = process.env.NODE_ENV || 'dev';
|
|
||||||
const Port = NODE_ENV === "production" ? parseInt(process.env.PORT || '') || 2210 : 2210;
|
|
||||||
|
|
||||||
app.listen(Port, () => {
|
|
||||||
console.log(`Server läuft auf Port ${Port}`);
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user