-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.14 KB
/
docker-build.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
43
name: Docker Build and Push
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
env:
DOCKER_CLI_AGGREGATE: 1
DOCKER_BUILDKIT: 1
strategy:
matrix:
base_image_tag:
- ubuntu-20.04
- ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ vars.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Build and push Docker image
run: |
docker buildx create --use
docker buildx build \
-t ${{ vars.DOCKER_HUB_USERNAME }}/srnjak-dev-playground-mail:latest \
-t ${{ vars.DOCKER_HUB_USERNAME }}/srnjak-dev-playground-mail:${{ matrix.base_image_tag }} \
-t ${{ vars.DOCKER_HUB_USERNAME }}/srnjak-dev-playground-mail:${{ matrix.base_image_tag }}-${{ github.run_number }} \
--build-arg BASE_IMAGE_TAG=${{ matrix.base_image_tag }} \
--push .