-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
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
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 }} |