Skip to content

Commit

Permalink
Add workflow back
Browse files Browse the repository at this point in the history
  • Loading branch information
Malfrador authored Oct 26, 2024
1 parent 2671edc commit 7d6815e
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Build release Docker image

on:
# Trigger the action manually from the UI
workflow_dispatch:
# Trigger the action when I create or push a `master` branch
push:
branches:
- 'master'

env:
DOCKER_IMAGE_NAME: erethon-docs
DOCKER_REGISTRY_URL: ${{ secrets.PRIVATE_REGISTRY_URL }}
jobs:
build_docker_images:
# Job name that shows in the GitHub UI
name: Build Docker Images
# Runner to use
runs-on: ubuntu-latest

steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ secrets.PRIVATE_REGISTRY_URL }}
username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }}
password: ${{ secrets.PRIVATE_REGISTRY_PASSWORD }}
- name: Checkout
uses: actions/checkout@v3

# Build the Docker image
- name: Build the Docker image
run: docker build . --file Dockerfile --tag $DOCKER_IMAGE_NAME:latest

# Tag the image
- name: Create a latest image as well
run: docker tag $DOCKER_IMAGE_NAME:latest $DOCKER_REGISTRY_URL/$DOCKER_IMAGE_NAME:latest

# Push the image to the registry
- name: Push the Docker image with version number
run: docker push $DOCKER_REGISTRY_URL/$DOCKER_IMAGE_NAME:latest

# Remove the local images
- name: Remove the Docker image with version number
run: docker rmi $DOCKER_REGISTRY_URL/$DOCKER_IMAGE_NAME:latest

- name: Remove the local image
run: docker rmi $DOCKER_IMAGE_NAME:latest

- name: Trigger Docker re-deployment
run: |
curl -H "Authorization: Bearer ${{ secrets.DEPLOYMENT_TOKEN }}" ${{ secrets.DEPLOYMENT_URL }}

0 comments on commit 7d6815e

Please sign in to comment.