Skip to content

Commit

Permalink
Attempt CI setup
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyEastham committed Nov 27, 2023
1 parent 5aaa12a commit c6d21bb
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/build-dockerfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Based on Publish Docker Container by GitHub Actions
name: publish-dockerfile

on:
push:
branches: [ project-presentations ]

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: dev
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Set up kubectl
uses: azure/setup-kubectl@v3
with:
kubeconfig: ${{ secrets.KUBECONFIG }}
- name: Deploy to Kubernetes
run: kubectl apply -f kubernetes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
push:
branches: [main]
branches-ignore: [project-presentations]

jobs:
pre-commit:
Expand Down
101 changes: 101 additions & 0 deletions kubernetes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
apiVersion: v1
kind: StorageClass
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer

---

apiVersion: v1
kind: PersistentVolume
metadata:
name: data-pv
spec:
capacity:
storage: 2Gi
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
storageClassName: local-storage
hostPath:
path: "/data"

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: manual
resources:
requests:
storage: 1Gi

---

apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: log-pvc
spec:
accessModes:
- ReadWriteOnce
storageClassName: manual
resources:
requests:
storage: 1Gi

---

apiVersion: v1
kind: Deployment
metadata:
name: agtern-deployment
labels:
app: agtern
spec:
replicas: 0
selector:
matchLabels:
app: agtern
template:
metadata:
labels:
app: agtern
spec:
containers:
- name: agtern
image: ghcr.io/agtern:dev
ports:
- containerPort: 8000
volumeMounts:
- name: data-volume
mountPath: /app/data
- name: log-volume
mountPath: /app/log
volumes:
- name: data-volume
persistentVolumeClaim:
claimName: data-pvc
- name: log-volume
persistentVolumeClaim:
claimName: config-pvc

---

apiVersion: v1
kind: Service
metadata:
name: agtern-service
spec:
selector:
app: agtern
ports:
- protocol: TCP
port: 80
targetPort: 8000
type: LoadBalancer

0 comments on commit c6d21bb

Please sign in to comment.