Skip to content

Try another Dockerfile #19

Try another Dockerfile

Try another Dockerfile #19

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 }}