deployemnt stuff

This commit is contained in:
2024-12-08 15:58:32 +01:00
parent 144caf2991
commit 9c58554b5a
6 changed files with 131 additions and 0 deletions

45
.github/workflows/osumusic.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: Docker Build and Push
on:
push:
branches:
- main
paths:
- 'proxy/**'
- 'frontend/**'
pull_request:
paths:
- 'proxy/**'
- 'frontend/**'
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Proxy Docker image
run: |
docker build -t juli0n21/proxy-container:latest -t juli0n21/proxy-container:${{ github.sha }} .
- name: Build Frontend Docker image
run: |
docker build -t juli0n21/frontend-container:latest -t juli0n21/frontend-container:${{ github.sha }} .
- name: Log in to Docker Hub
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
run: |
echo "${DOCKER_HUB_TOKEN}" | docker login -u "${DOCKER_HUB_USERNAME}" --password-stdin
- name: Push Docker image
run: |
docker push juli0n21/proxy-container:${{ github.sha }}
docker push juli0n21/proxy-container:latest
docker push juli0n21/frontend-container:${{ github.sha }}
docker push juli0n21/frontend-container:latest

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: frontend-service
namespace: osu-music
spec:
selector:
app: frontend
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 5001
type: NodePort

20
deployment/frontend.yml Normal file
View File

@@ -0,0 +1,20 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend-deployment
namespace: osu-music
spec:
replicas: 1
selector:
matchLabels:
app: frontend
template:
metadata:
labels:
app: frontend
spec:
containers:
- name: frontend-container
image: frontend
ports:
- containerPort: 80

11
deployment/proxy-pvc.yml Normal file
View File

@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: proxy-data-pvc
namespace: osu-music
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi

View File

@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: backend-service
namespace: osu-music
spec:
selector:
app: backend
ports:
- protocol: TCP
port: 80
targetPort: 80
nodePort: 5002
type: NodePort

27
deployment/proxy.yml Normal file
View File

@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend-deployment
namespace: osu-music
spec:
replicas: 1
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
spec:
containers:
- name: proxy-container
image: proxy
ports:
- containerPort: 80
volumeMounts:
- name: proxy-data
mountPath: /app/data
volumes:
- name: proxy-data
persistentVolumeClaim:
claimName: proxy-data-pvc