-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (40 loc) · 1.33 KB
/
docker-build-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: DockerBuildPush
on:
push:
branches: [main]
pull_request:
jobs:
docker:
runs-on: ubuntu-latest
steps:
- 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 }}
password: ${{ secrets.DOCKER_REGISTRY_PASS }}
-
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 $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
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}