-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CD - Add GitHub Action to push Docker image to Docker Hub (#275)
* CD - Add GitHub Action to push Docker image to Docker Hub * BUILD - Reduce size of image by using slim version of Debian * CI - Modify Push Docker Image action to build and push Docker image to linux/amd64 and linux/arm64 architectures
- Loading branch information
Showing
2 changed files
with
40 additions
and
2 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,38 @@ | ||
name: Push Docker Image | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
push-docker-image: | ||
name: Push Docker Image | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
strategy: | ||
matrix: | ||
platforms: | ||
- linux/amd64 | ||
- linux/arm64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Retrieve major version | ||
uses: winterjung/split@v2 | ||
id: split | ||
with: | ||
msg: ${{ github.ref_name }} | ||
separator: . | ||
- name: Log in to registry | ||
uses: docker/login-action@v3 | ||
with: | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
- name: Build and push the Docker image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
platforms: ${{ matrix.platforms }} | ||
push: true | ||
tags: ${{ secrets.DOCKERHUB_REPOSITORY }}:${{ github.ref_name }},${{ secrets.DOCKERHUB_REPOSITORY }}:${{ steps.split.outputs._0 }},${{ secrets.DOCKERHUB_REPOSITORY }}:latest |
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