Skip to content

Commit

Permalink
Fixes added to the docker-build-push job
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherlouet committed Oct 26, 2024
1 parent 6a2cbe5 commit 7c86e98
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,39 @@ on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
docker:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v1
- name: Check out code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: "main"
-
name: Login to Harbor
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
registry: ${{ secrets.DOCKER_REGISTRY_URL }}
username: ${{ secrets.DOCKER_REGISTRY_USER }}
password: ${{ secrets.DOCKER_REGISTRY_PASS }}

- uses: actions/checkout@v3
- name: BuildAndPushImageOnHarbor
-
name: Build and push
id: docker_build
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY_URL }}
DOCKER_REPOSITORY: breizhcamp/kalon
IMAGE_TAG: ${{ steps.tag_version.outputs.new_version }}
run: |
docker build ./ -t ${{ secrets.DOCKER_REGISTRY_URL }}/breizhcamp/kalon:${{ github.run_number }}
docker push ${{ secrets.DOCKER_REGISTRY_URL }}/breizhcamp/kalon:${{ github.run_number }}
DOCKER_BUILDKIT=1 docker build -t $DOCKER_REGISTRY/$DOCKER_REPOSITORY:$IMAGE_TAG -t $DOCKER_REGISTRY/$DOCKER_REPOSITORY:latest .
docker push $DOCKER_REGISTRY/$DOCKER_REPOSITORY:$IMAGE_TAG
docker push $DOCKER_REGISTRY/$DOCKER_REPOSITORY:latest
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}

0 comments on commit 7c86e98

Please sign in to comment.