npm
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,6 +10,7 @@ __pycache__/
|
||||
*.so
|
||||
.Python
|
||||
|
||||
node_modules/
|
||||
# Generated diagram files
|
||||
*.pdf
|
||||
*.gv
|
||||
|
||||
61
Dockerfile
61
Dockerfile
@@ -1,61 +1,18 @@
|
||||
# Multi-stage Dockerfile for static frontend deployment
|
||||
# Stage 1: Build the diagrams
|
||||
FROM python:3.11-slim AS builder
|
||||
# Build stage
|
||||
FROM node:20-alpine AS build
|
||||
|
||||
# Install system dependencies for Graphviz
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
graphviz \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
# Copy package files
|
||||
COPY package*.json ./
|
||||
RUN npm ci
|
||||
|
||||
# Copy source files
|
||||
COPY *.py .
|
||||
COPY . .
|
||||
RUN npm run build
|
||||
|
||||
# Generate diagrams (outputs will be in /app)
|
||||
RUN python lan_architecture.py && \
|
||||
python main.py
|
||||
|
||||
# Verify generated files exist
|
||||
RUN ls -la *.png || echo "Warning: No PNG files generated"
|
||||
|
||||
# Stage 2: Serve with Nginx
|
||||
# Runtime stage
|
||||
FROM nginx:alpine
|
||||
|
||||
# Remove default nginx static assets
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY --from=build /app/dist/ /usr/share/nginx/html/
|
||||
|
||||
# Copy generated diagram files from builder stage
|
||||
COPY --from=builder /app/*.png /usr/share/nginx/html/
|
||||
|
||||
# Copy any HTML/CSS files for the frontend
|
||||
COPY public/ /usr/share/nginx/html/
|
||||
|
||||
# Create a simple nginx config for serving static files
|
||||
RUN echo 'server { \
|
||||
listen 80; \
|
||||
server_name _; \
|
||||
root /usr/share/nginx/html; \
|
||||
index index.html; \
|
||||
location / { \
|
||||
try_files $uri $uri/ /index.html; \
|
||||
} \
|
||||
# Enable CORS if needed \
|
||||
add_header Access-Control-Allow-Origin *; \
|
||||
}' > /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Expose port 80
|
||||
EXPOSE 80
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --quiet --tries=1 --spider http://localhost/ || exit 1
|
||||
|
||||
# Start nginx
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
viewer:
|
||||
build:
|
||||
context: .
|
||||
context: /opt/apps/viewer
|
||||
dockerfile: Dockerfile
|
||||
container_name: viewer
|
||||
restart: unless-stopped
|
||||
@@ -14,15 +12,15 @@ services:
|
||||
- "traefik.http.routers.viewer.rule=Host(`viewer.appmodel.nl`)"
|
||||
- "traefik.http.routers.viewer.entrypoints=websecure"
|
||||
- "traefik.http.routers.viewer.tls=true"
|
||||
- "traefik.http.routers.viewer.tls.certresolver=letsencrypt"
|
||||
- "traefik.http.services.viewer.loadbalancer.server.port=80"
|
||||
# Optional: mount logs
|
||||
volumes:
|
||||
- ./logs:/var/log/nginx
|
||||
# Optional: environment variables
|
||||
environment:
|
||||
- TZ=Europe/Amsterdam
|
||||
- "traefik.http.routers.viewer-http.rule=Host(`viewer.appmodel.nl`)"
|
||||
- "traefik.http.routers.viewer-http.entrypoints=web"
|
||||
- "traefik.http.routers.viewer-http.middlewares=viewer-https"
|
||||
- "traefik.http.middlewares.viewer-https.redirectscheme.scheme=https"
|
||||
- "traefik.http.routers.auction.tls.certresolver=letsencrypt",
|
||||
- "traefik.http.middlewares.viewer-https.redirectscheme.permanent=true"
|
||||
|
||||
networks:
|
||||
traefik_net:
|
||||
external: true
|
||||
name: traefik_net
|
||||
|
||||
4651
package-lock.json
generated
Normal file
4651
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
24
package.json
Normal file
24
package.json
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"name": "viewer",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"private": true,
|
||||
"keywords": [
|
||||
""
|
||||
],
|
||||
"license": "",
|
||||
"author": "",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"start": "webpack serve --open --config webpack.config.dev.js",
|
||||
"build": "webpack --config webpack.config.prod.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"copy-webpack-plugin": "^11.0.0",
|
||||
"html-webpack-plugin": "^5.6.0",
|
||||
"webpack": "^5.91.0",
|
||||
"webpack-cli": "^5.1.4",
|
||||
"webpack-dev-server": "^5.0.4",
|
||||
"webpack-merge": "^5.10.0"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user