bullseye slim #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Build and Push | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
env: | |
REGISTRY: registry.k8s.yyz1.hammy.network | |
IMAGE_NAME: blog | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to the Docker registry | |
uses: docker/login-action@v2 | |
with: | |
registry: registry.k8s.yyz1.hammy.network | |
username: ${{ secrets.REGISTRY_USERNAME }} | |
password: ${{ secrets.REGISTRY_PASSWORD }} | |
- name: Get Build Time | |
run: echo "TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
env: | |
COMMIT: ${{ github.sha }} | |
REF: ${{ github.ref }} | |
TIME: ${{ env.TIME }} | |
- name: Reload Deployment | |
env: | |
RELOADER_KEY: ${{ secrets.RELOADER_KEY }} | |
run: | | |
response=$(curl -s -o /dev/null -w "%{http_code}" -X GET "http://k8s.yyz1.hammy.network:8844/reload/deployments/hamptonmoore" -H "Authorization: ${RELOADER_KEY}") | |
if [ "$response" -ne 200 ]; then | |
echo "Failed to reload deployment, server responded with HTTP status $response" | |
exit 1 | |
fi | |
echo "Deployment reloaded successfully" |