-
Notifications
You must be signed in to change notification settings - Fork 535
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #153 from tiagorlampert/test-ci-on-pr
build docker image ci
- Loading branch information
Showing
2 changed files
with
37 additions
and
1 deletion.
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,36 @@ | ||
name: Build and Push Docker Image to Docker Hub | ||
|
||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
branches: | ||
- 'main' | ||
|
||
env: | ||
REGISTRY_IMAGE: tiagorlampert/chaos | ||
|
||
jobs: | ||
build: | ||
name: build and push docker image to hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: login to docker registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{secrets.DOCKERHUB_USERNAME}} | ||
password: ${{secrets.DOCKERHUB_TOKEN}} | ||
|
||
- name: build and push docker image to registry | ||
if: ${{ success() }} | ||
run: | | ||
TAG=${GITHUB_SHA::7} | ||
IMAGE=$REGISTRY_IMAGE | ||
docker build \ | ||
--build-arg APP_VERSION=$TAG \ | ||
--tag $IMAGE:$TAG \ | ||
--tag $IMAGE:latest -f Dockerfile . | ||
docker push $IMAGE --all-tags |
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