Initial version 1.1

This commit is contained in:
Karmaa
2025-02-06 23:47:21 -06:00
commit 8afadf6176
23 changed files with 6716 additions and 0 deletions

30
docker/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# Build frontend
FROM node:18-alpine AS frontend-build
WORKDIR /app
COPY frontend/package*.json ./frontend/
RUN npm --prefix frontend install
COPY frontend/ ./frontend/
RUN npm --prefix frontend run build
# Build backend
FROM node:18-alpine AS backend-build
WORKDIR /backend
COPY backend/package*.json ./
RUN npm install
COPY backend/ .
# Configure nginx
FROM nginx:alpine
RUN apk add --no-cache nodejs npm
COPY docker/nginx.conf /etc/nginx/nginx.conf
COPY --from=frontend-build /app/frontend/dist /usr/share/nginx/html
COPY --from=backend-build /backend /backend
COPY --from=backend-build /backend/entrypoint.sh /backend/entrypoint.sh
# Configure start-up
RUN chmod +x /backend/entrypoint.sh
ENTRYPOINT ["/src/backend/entrypoint.sh"]
EXPOSE 8080
EXPOSE 8081

38
docker/nginx.conf Normal file
View File

@@ -0,0 +1,38 @@
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 8080;
server_name localhost;
# Serve the React app
location / {
root /usr/share/nginx/html;
index index.html index.htm;
}
# Proxy WebSocket requests
location /ws/ {
proxy_pass http://localhost:8081; # Backend WebSocket server
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
# Error pages
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}