Build Phase 1 application foundation

This commit is contained in:
Media
2026-08-16 19:16:45 -05:00
parent 9aab48643b
commit eb19675a5c
30 changed files with 3375 additions and 2207 deletions
+19 -9
View File
@@ -1,14 +1,24 @@
FROM node:22-alpine AS build
FROM node:22.23.2-bookworm-slim AS build
ARG PNPM_VERSION=10.29.3
WORKDIR /app
RUN corepack enable
RUN corepack enable && corepack prepare "pnpm@${PNPM_VERSION}" --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY package.json pnpm-workspace.yaml pnpm-lock.yaml ./
COPY server/package.json ./server/package.json
COPY client/package.json ./client/package.json
COPY . .
RUN pnpm build
RUN pnpm install --frozen-lockfile --filter @announcements/client...
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
COPY client ./client
RUN pnpm --filter @announcements/client build
FROM nginx:1.30.4-alpine
COPY client/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /app/client/dist /usr/share/nginx/html
EXPOSE 80
+42
View File
@@ -0,0 +1,42 @@
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
listen [::]:80;
server_name _;
root /usr/share/nginx/html;
index index.html;
resolver 127.0.0.11 valid=10s ipv6=off;
set $api_origin http://api:7532;
location ~ ^/(api|health|media)(/|$) {
proxy_pass $api_origin;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /socket.io/ {
proxy_pass $api_origin;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_buffering off;
proxy_read_timeout 75s;
}
location / {
try_files $uri $uri/ /index.html;
}
}
+4 -1
View File
@@ -1,8 +1,11 @@
{
"name": "client",
"name": "@announcements/client",
"private": true,
"version": "0.0.0",
"type": "module",
"engines": {
"node": ">=22.13.0"
},
"scripts": {
"dev": "vite",
"build": "vite build",
-1572
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -2,7 +2,7 @@ import { useEffect, useState } from "react";
import { io } from "socket.io-client";
import "./App.css";
const socket = io("http://10.40.0.2:7532");
const socket = io();
export default function App() {
const [slides, setSlides] = useState([]);
@@ -64,4 +64,4 @@ export default function App() {
/>
</div>
);
}
}
+19 -6
View File
@@ -1,7 +1,20 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})
export default defineConfig(({ mode }) => {
const environment = loadEnv(mode, ".", "VITE_");
const target = environment.VITE_API_PROXY_TARGET || "http://127.0.0.1:7532";
const proxy = { target, changeOrigin: true };
return {
plugins: [react()],
server: {
proxy: {
"/api": proxy,
"/health": proxy,
"/media": proxy,
"/socket.io": { ...proxy, ws: true },
},
},
};
});