feat: Добавлена поддержка K8s и Docker
This commit is contained in:
parent
75bb1bc612
commit
bf4619b78a
4
API/.dockerignore
Normal file
4
API/.dockerignore
Normal file
@ -0,0 +1,4 @@
|
||||
.venv
|
||||
k8s
|
||||
.idea
|
||||
.env
|
||||
@ -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=["*"],
|
||||
|
||||
@ -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
7
WEB/.dockerignore
Normal file
@ -0,0 +1,7 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
build
|
||||
.dockerignore
|
||||
.git
|
||||
k8s
|
||||
.env
|
||||
2
WEB/.gitignore
vendored
2
WEB/.gitignore
vendored
@ -23,3 +23,5 @@ dist-ssr
|
||||
*.sln
|
||||
*.sw?
|
||||
*/.vscode/*
|
||||
|
||||
.env
|
||||
|
||||
25
WEB/Dockerfile
Normal file
25
WEB/Dockerfile
Normal 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"]
|
||||
5
WEB/k8s/helm/teamfolio-web/Chart.yaml
Normal file
5
WEB/k8s/helm/teamfolio-web/Chart.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
apiVersion: v2
|
||||
name: teamfolio-web-app
|
||||
description: teamfolio WEB project
|
||||
version: 0.1.0
|
||||
appVersion: "1.0"
|
||||
22
WEB/k8s/helm/teamfolio-web/templates/deployment.yaml
Normal file
22
WEB/k8s/helm/teamfolio-web/templates/deployment.yaml
Normal 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 }}
|
||||
23
WEB/k8s/helm/teamfolio-web/templates/ingress.yaml
Normal file
23
WEB/k8s/helm/teamfolio-web/templates/ingress.yaml
Normal 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 }}
|
||||
11
WEB/k8s/helm/teamfolio-web/templates/service.yaml
Normal file
11
WEB/k8s/helm/teamfolio-web/templates/service.yaml
Normal 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 }}
|
||||
23
WEB/k8s/helm/teamfolio-web/values.yaml
Normal file
23
WEB/k8s/helm/teamfolio-web/values.yaml
Normal 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
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user