Skip to content

Added utility script and pipeline to build/push Docker image #6

Added utility script and pipeline to build/push Docker image

Added utility script and pipeline to build/push Docker image #6

name: DockerBuildPush
on:
push:
branches: [main]
pull_request:
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@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 }}
password: ${{ secrets.DOCKER_REGISTRY_PASS }}
-
name: Build and push
env:
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY_URL }}
DOCKER_REPOSITORY: breizhcamp/kalon
IMAGE_TAG: ${{ steps.tag_version.outputs.new_version }}
run: |
docker build -t $DOCKER_REGISTRY/$DOCKER_REPOSITORY:$IMAGE_TAG -t $DOCKER_REGISTRY/$DOCKER_REPOSITORY:latest -f .
docker push $DOCKER_REGISTRY/$DOCKER_REPOSITORY:$IMAGE_TAG
docker push $DOCKER_REGISTRY/$DOCKER_REPOSITORY:latest