10 Commits
7 changed files with 55 additions and 25 deletions
+5 -2
View File
@@ -92,7 +92,10 @@ builder.Services.AddOpenApi(options =>
}); });
builder.Services.AddCors(options => options.AddPolicy("AllowFrontend", policy => builder.Services.AddCors(options => options.AddPolicy("AllowFrontend", policy =>
policy.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod().AllowCredentials())); policy.WithOrigins("https://localhost:3000", "https://localhost:8076", "https://console.ifri.khongisa.co.za")
.AllowAnyHeader()
.AllowAnyMethod()
.AllowCredentials()));
var app = builder.Build(); var app = builder.Build();
@@ -106,8 +109,8 @@ app.UseHsts();
app.UseHttpsRedirection(); app.UseHttpsRedirection();
app.UseRouting(); app.UseRouting();
app.UseOutputCache();
app.UseCors("AllowFrontend"); app.UseCors("AllowFrontend");
app.UseOutputCache();
app.UseAuthentication(); app.UseAuthentication();
app.UseAuthorization(); app.UseAuthorization();
+16 -11
View File
@@ -3,29 +3,34 @@ FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
# Copy dependency definitions # Enable corepack to use Yarn
COPY package*.json ./ RUN corepack enable
# Install dependencies # Copy dependency definitions from the subdirectory
RUN npm ci || npm install COPY PostFundManagement.ConsoleUI/package*.json PostFundManagement.ConsoleUI/yarn.lock* ./
# Copy application source # Install dependencies via Yarn
COPY . . RUN yarn install --frozen-lockfile || yarn install
# Copy application source from the subdirectory
COPY PostFundManagement.ConsoleUI/ ./
# Build Vite application for production # Build Vite application for production
RUN npm run build RUN yarn build
# Stage 2: Production Nginx Server # Stage 2: Production Nginx Server
FROM nginx:alpine FROM nginx:alpine
# Copy nginx configuration WORKDIR /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy nginx configuration from stage 1 build directory
COPY --from=builder /app/nginx.conf /etc/nginx/conf.d/default.conf
# Copy compiled static assets from build stage # Copy compiled static assets from build stage
COPY --from=builder /app/dist /usr/share/nginx/html COPY --from=builder /app/dist ./
# Copy entrypoint script for dynamic runtime environment variables # Copy entrypoint script for dynamic runtime environment variables
COPY docker-entrypoint.sh /docker-entrypoint.sh COPY --from=builder /app/docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh RUN chmod +x /docker-entrypoint.sh
# Expose port 3000 # Expose port 3000
@@ -7,13 +7,13 @@ services:
dockerfile: Dockerfile dockerfile: Dockerfile
container_name: pfm-console container_name: pfm-console
ports: ports:
- "3000:3000" - "8076:3000"
environment: environment:
# OIDC Identity Provider Configuration # OIDC Identity Provider Configuration
- OIDC_AUTHORITY=https://sts.security.khongisa.co.za - OIDC_AUTHORITY=${OIDC_AUTHORITY}
- OIDC_AUDIENCE=pfm-api-dev - OIDC_AUDIENCE=${OIDC_AUDIENCE}
- OIDC_CLIENT_ID=pfm-scalar-dev - OIDC_CLIENT_ID=${OIDC_CLIENT_ID}
- OIDC_CLIENT_SECRET=secret_71f88570a46eb22eb5270b47f69e3332c84d8db85d008f0276cb7431c8872d27 - OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET}
# Backend API Configuration # Backend API Configuration
- API_BASE_URL=https://api.ifri.khongisa.co.za/ - API_BASE_URL=${API_BASE_URL}
restart: unless-stopped restart: unless-stopped
@@ -32,6 +32,7 @@
"devDependencies": { "devDependencies": {
"@types/express": "^4.17.21", "@types/express": "^4.17.21",
"@types/node": "^22.14.0", "@types/node": "^22.14.0",
"@vitejs/plugin-basic-ssl": "^2.3.0",
"autoprefixer": "^10.5.6", "autoprefixer": "^10.5.6",
"esbuild": "^0.25.0", "esbuild": "^0.25.0",
"postcss": "^8.5.28", "postcss": "^8.5.28",
+2 -3
View File
@@ -1,3 +1,4 @@
import basicSsl from '@vitejs/plugin-basic-ssl';
import tailwindcss from '@tailwindcss/vite'; import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react'; import react from '@vitejs/plugin-react';
import path from 'path'; import path from 'path';
@@ -5,7 +6,7 @@ import { defineConfig } from 'vite';
export default defineConfig(() => { export default defineConfig(() => {
return { return {
plugins: [react(), tailwindcss()], plugins: [react(), tailwindcss(), basicSsl()],
resolve: { resolve: {
alias: { alias: {
'@': path.resolve(__dirname, '.'), '@': path.resolve(__dirname, '.'),
@@ -13,9 +14,7 @@ export default defineConfig(() => {
}, },
server: { server: {
// HMR is disabled in AI Studio via DISABLE_HMR env var. // HMR is disabled in AI Studio via DISABLE_HMR env var.
// Do not modify—file watching is disabled to prevent flickering during agent edits.
hmr: process.env.DISABLE_HMR !== 'true', hmr: process.env.DISABLE_HMR !== 'true',
// Disable file watching when DISABLE_HMR is true to save CPU during agent edits.
watch: process.env.DISABLE_HMR === 'true' ? null : {}, watch: process.env.DISABLE_HMR === 'true' ? null : {},
}, },
}; };
+5
View File
@@ -942,6 +942,11 @@
"@types/node" "*" "@types/node" "*"
"@types/send" "<1" "@types/send" "<1"
"@vitejs/plugin-basic-ssl@^2.3.0":
version "2.3.0"
resolved "https://registry.yarnpkg.com/@vitejs/plugin-basic-ssl/-/plugin-basic-ssl-2.3.0.tgz#f505b1c197d8cb4fd6e213a78847574ecc51e2f9"
integrity sha512-bdyo8rB3NnQbikdMpHaML9Z1OZPBu6fFOBo+OtxsBlvMJtysWskmBcnbIDhUqgC8tcxNv/a+BcV5U+2nQMm1OQ==
"@vitejs/plugin-react@^5.0.4": "@vitejs/plugin-react@^5.0.4":
version "5.2.0" version "5.2.0"
resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-5.2.0.tgz#108bd0f566f288ce3566982df4eff137ded7b15f" resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-5.2.0.tgz#108bd0f566f288ce3566982df4eff137ded7b15f"
+17
View File
@@ -67,3 +67,20 @@ services:
# Redis overrides # Redis overrides
- ConnectionStrings__Redis=${REDIS_CONNECTION_STRING:-192.168.1.171:6379,ssl=false,abortConnect=false} - ConnectionStrings__Redis=${REDIS_CONNECTION_STRING:-192.168.1.171:6379,ssl=false,abortConnect=false}
pfm-console:
image: pfm-console
build:
context: .
dockerfile: PostFundManagement.ConsoleUI/Dockerfile
container_name: pfm-console
ports:
- "8076:3000"
environment:
# OIDC Identity Provider Configuration
- OIDC_AUTHORITY=${OIDC_AUTHORITY:-https://}
- OIDC_AUDIENCE=${OIDC_AUDIENCE:-aud}
- OIDC_CLIENT_ID=${OIDC_CLIENT_ID:-clientid}
- OIDC_CLIENT_SECRET=${OIDC_CLIENT_SECRET:-yoursecret}
# Backend API Configuration
- API_BASE_URL=${API_BASE_URL:-https://api.ifri.khongisa.co.za/}
restart: unless-stopped