Skip to content

Commit

Permalink
Add mysql manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
moosavi.smd committed Apr 26, 2024
1 parent 4658594 commit 0d9c441
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
git config --global user.email '[email protected]'
git add values.yaml
git commit -m "Update values.yaml"
git push
git push
4 changes: 3 additions & 1 deletion app/dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# First stage
FROM golang:1.22 as builder

WORKDIR /app
Expand All @@ -7,7 +8,8 @@ RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o myapp .

FROM alpine:latest
# Second Stage
FROM alpine:latest

WORKDIR /root/
COPY --from=builder /app/myapp .
Expand Down
70 changes: 70 additions & 0 deletions mysql/mysql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: mysql-pv
labels:
type: local
spec:
storageClassName: manual
capacity:
storage: 5Gi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/data"
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mysql-pv-claim
spec:
storageClassName: manual
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql
spec:
selector:
matchLabels:
app: mysql
strategy:
type: Recreate
template:
metadata:
labels:
app: mysql
spec:
containers:
- image: mysql:8.0
name: mysql
env:
- name: MYSQL_ROOT_PASSWORD
value: password
ports:
- containerPort: 3306
name: mysql
volumeMounts:
- name: mysql-persistent-storage
mountPath: /var/lib/mysql
volumes:
- name: mysql-persistent-storage
persistentVolumeClaim:
claimName: mysql-pv-claim
---
apiVersion: v1
kind: Service
metadata:
name: mysql
spec:
ports:
- port: 3306
selector:
app: mysql
clusterIP: None

0 comments on commit 0d9c441

Please sign in to comment.