feat : initial commit

This commit is contained in:
2025-06-20 05:56:38 +00:00
commit 9a7e75865a
28 changed files with 1260 additions and 0 deletions
@@ -0,0 +1,32 @@
# Node.js Multi-stage build for React
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Production stage with simple Nginx
FROM nginx:alpine
# Copy built app
COPY --from=builder /app/build /usr/share/nginx/html
# Create simple nginx config for React SPA
RUN echo 'server {' > /etc/nginx/conf.d/default.conf && \
echo ' listen 80;' >> /etc/nginx/conf.d/default.conf && \
echo ' server_name localhost;' >> /etc/nginx/conf.d/default.conf && \
echo ' root /usr/share/nginx/html;' >> /etc/nginx/conf.d/default.conf && \
echo ' index index.html;' >> /etc/nginx/conf.d/default.conf && \
echo ' location / {' >> /etc/nginx/conf.d/default.conf && \
echo ' try_files $uri $uri/ /index.html;' >> /etc/nginx/conf.d/default.conf && \
echo ' }' >> /etc/nginx/conf.d/default.conf && \
echo ' location /health {' >> /etc/nginx/conf.d/default.conf && \
echo ' return 200 "healthy";' >> /etc/nginx/conf.d/default.conf && \
echo ' add_header Content-Type text/plain;' >> /etc/nginx/conf.d/default.conf && \
echo ' }' >> /etc/nginx/conf.d/default.conf && \
echo '}' >> /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
+50
View File
@@ -0,0 +1,50 @@
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
location / {
try_files $uri $uri/ /index.html;
}
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
}
}
@@ -0,0 +1,16 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: frontend-config
namespace: team1tier-healthsync-front-ns
data:
runtime-env.js: |
window.__runtime_config__ = {
GOOGLE_CLIENT_ID: '198383870460-s1s72vgu91nq9qvg5dai28vafj7mlag1.apps.googleusercontent.com',
AUTH_URL: 'http://team1tier.20.214.196.128.nip.io/api/auth',
HEALTH_URL: 'http://team1tier.20.214.196.128.nip.io/api/health',
INTELLIGENCE_URL: 'http://team1tier.20.214.196.128.nip.io/api/intelligence',
GOAL_URL: 'http://team1tier.20.214.196.128.nip.io/api/goals',
MOTIVATOR_URL: 'http://team1tier.20.214.196.128.nip.io/api/motivator',
USER_URL: 'http://team1tier.20.214.196.128.nip.io/api/user'
};
@@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: healthsync-front
namespace: team1tier-healthsync-front-ns
labels:
app: healthsync-front
spec:
revisionHistoryLimit: 3
replicas: 1
selector:
matchLabels:
app: healthsync-front
template:
metadata:
labels:
app: healthsync-front
spec:
imagePullSecrets:
- name: acr-secret
containers:
- name: healthsync-front
image: acrhealthsync01.azurecr.io/team1tier/healthsync-front:1.0.23
imagePullPolicy: Always
ports:
- containerPort: 80
resources:
requests:
cpu: 256m
memory: 256Mi
limits:
cpu: 1024m
memory: 1024Mi
volumeMounts:
- name: runtime-config
mountPath: /usr/share/nginx/html/runtime-env.js
subPath: runtime-env.js
volumes:
- name: runtime-config
configMap:
name: frontend-config
@@ -0,0 +1,21 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: healthsync-frontend-ingress
namespace: team1tier-healthsync-front-ns
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/ssl-redirect: "false"
spec:
ingressClassName: nginx
rules:
- host: team1tier.20.214.196.128.nip.io
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: healthsync-front-service
port:
number: 80
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: healthsync-front-service
namespace: team1tier-healthsync-front-ns
labels:
app: healthsync-front
spec:
type: LoadBalancer
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: healthsync-front