Skip to content

Commit

Permalink
build docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagorlampert committed Oct 26, 2024
1 parent 92cdf7a commit 636a2cf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
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 : pull
if: ${{ success() }}
run: |
git pull
- 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
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ on:
push:
branches:
- "*"
- "!main"
pull_request:
branches:
- "*"
- "!main"

jobs:
test:
Expand All @@ -19,7 +21,7 @@ jobs:
go-version: '1.22.x'

- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Download dependencies
run: go mod download
Expand Down

0 comments on commit 636a2cf

Please sign in to comment.