-
Notifications
You must be signed in to change notification settings - Fork 5
45 lines (44 loc) · 1.18 KB
/
image-build.yaml
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
44
45
name: image-build
on:
push:
branches:
- "main"
paths:
- "Dockerfile"
- ".github/workflows/image-build.yaml"
- "!**.md"
jobs:
image-build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
timeout-minutes: 5
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
timeout-minutes: 5
with:
images: improwised/ghar-image
tags: |
type=raw,value={{branch}}-{{sha}}-{{date 'X'}}
type=raw,value=latest
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
timeout-minutes: 5
- name: Login to DockerHub
uses: docker/login-action@v3
timeout-minutes: 5
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
timeout-minutes: 5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}