feat: Добавлена поддержка K8s и Docker

This commit is contained in:
Андрей Дувакин 2025-06-07 21:43:30 +05:00
parent 75bb1bc612
commit bf4619b78a
12 changed files with 129 additions and 2 deletions

4
API/.dockerignore Normal file
View File

@ -0,0 +1,4 @@
.venv
k8s
.idea
.env

View File

@ -22,7 +22,7 @@ def start_app():
api_app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:5173"],
allow_origins=["https://api.numerum.team", "https://numerum.team", "http://localhost:5173"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],

View File

@ -24,6 +24,11 @@ spec:
secretKeyRef:
name: teamfolio-api-secret
key: SECRET_KEY
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: teamfolio-api-secret
key: DATABASE_URL
volumeMounts:
- name: uploads-volume
mountPath: {{ .Values.persistence.uploads.containerPath }}

7
WEB/.dockerignore Normal file
View File

@ -0,0 +1,7 @@
node_modules
npm-debug.log
build
.dockerignore
.git
k8s
.env

2
WEB/.gitignore vendored
View File

@ -23,3 +23,5 @@ dist-ssr
*.sln
*.sw?
*/.vscode/*
.env

25
WEB/Dockerfile Normal file
View File

@ -0,0 +1,25 @@
FROM node:20-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY . .
ARG VITE_BASE_URL
ENV VITE_BASE_URL=https://api.numerum.team
RUN npm run build
FROM node:20-alpine
WORKDIR /app
RUN npm install -g serve
COPY --from=builder /app/dist /app
EXPOSE 3000
CMD ["serve", "-s", ".", "-l", "3000"]

View File

@ -0,0 +1,5 @@
apiVersion: v2
name: teamfolio-web-app
description: teamfolio WEB project
version: 0.1.0
appVersion: "1.0"

View File

@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Chart.Name }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: {{ .Chart.Name }}
template:
metadata:
labels:
app: {{ .Chart.Name }}
spec:
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.port }}
resources:
{{- toYaml .Values.resources | nindent 12 }}

View File

@ -0,0 +1,23 @@
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: visus-api-ingress
annotations:
cert-manager.io/cluster-issuer: lets-encrypt
spec:
tls:
- hosts:
- {{ .Values.ingress.domain }}
secretName: {{ .Values.ingress.secretTLSName }}
ingressClassName: public
rules:
- host: {{ .Values.ingress.domain }}
http:
paths:
- path: {{ .Values.ingress.path }}
pathType: {{ .Values.ingress.pathType }}
backend:
service:
name: {{ .Chart.Name }}-service
port:
number: {{ .Values.service.port }}

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Chart.Name }}-service
spec:
type: {{ .Values.service.type }}
ports:
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.port }}
selector:
app: {{ .Chart.Name }}

View File

@ -0,0 +1,23 @@
replicaCount: 1
image:
repository: archi341/teamfolio-web
tag: latest
pullPolicy: Always
service:
type: ClusterIP
port: 3000
resources:
limits:
memory: 512Mi
cpu: 500m
ingress:
secretTLSName: teamfolio-web-tls-secret
domain: numerum.team
path: /
pathType: Prefix

View File

@ -1,5 +1,5 @@
const CONFIG = {
BASE_URL: "http://127.0.0.1:8000",
BASE_URL: import.meta.env.VITE_BASE_URL || "http://127.0.0.1:8000",
};
export default CONFIG;