diff --git a/.gitea/workflows/main.yml b/.gitea/workflows/main.yml index 3eb7df6..05c296f 100644 --- a/.gitea/workflows/main.yml +++ b/.gitea/workflows/main.yml @@ -58,6 +58,32 @@ jobs: name: go-api-binaries path: build/ + docker-push: + name: Push Image to Gitea Registry + runs-on: docker-latest + needs: [docker-test, go-build] + steps: + - uses: actions/checkout@v3 + + - name: Docker login + env: + REGISTRY_HOST: git.petyaserver.uk + REGISTRY_USER: ${{ secrets.REGISTRY_USER }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + run: | + : "${REGISTRY_HOST:=git.petyaserver.uk}" + echo "$REGISTRY_PASSWORD" | docker login "$REGISTRY_HOST" -u "$REGISTRY_USER" --password-stdin + + - name: Build & push + env: + REGISTRY_HOST: git.petyaserver.uk + REGISTRY_USER: ${{ secrets.REGISTRY_USER }} + run: | + : "${REGISTRY_HOST:=git.petyaserver.uk}" + IMAGE="$REGISTRY_HOST/$REGISTRY_USER/go-api:latest" + docker build -t "$IMAGE" . + docker push "$IMAGE" + k8s-some-test: name: Kubernetes Smoke Test runs-on: docker-latest @@ -82,7 +108,7 @@ jobs: k8s-deploy: name: Kubernetes Deployment runs-on: docker-latest - needs: [go-build, k8s-some-test] + needs: [go-build, k8s-some-test, docker-push] steps: - name: Checkout repository uses: actions/checkout@v3 diff --git a/k8s/deployment.yaml b/k8s/deployment.yaml index adcd8d1..bb651de 100644 --- a/k8s/deployment.yaml +++ b/k8s/deployment.yaml @@ -20,13 +20,12 @@ spec: app: go-api spec: + imagePullSecrets: + - name: gitea-regcred + containers: - name: go-api - image: zomborip/go-api:latest + image: git.petyaserver.uk/zomborip/go-api:latest + imagePullPolicy: Always ports: - containerPort: 8080 - resources: - requests: - cpu: 100m - limits: - cpu: 500m