-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (73 loc) · 1.92 KB
/
build.yml
File metadata and controls
76 lines (73 loc) · 1.92 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Docker Image CI
permissions:
contents: read
on:
workflow_dispatch:
push:
branches: ["main"]
paths-ignore:
- "README.md"
- "LICENSE"
- ".gitignore"
- "images/**"
env:
REGISTRY: docker.io
USERNAME: pebenbow
TARGET: "pebenbow/open-sql-docker"
jobs:
build:
environment: Dockerhub
env:
TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Create Fully Qualified Image Name
run: |
echo "IMAGE_NAME=${TEMP,,}" >>${GITHUB_ENV}
env:
TEMP: '${{ env.REGISTRY }}/${{ env.TARGET }}'
-
name: Generate Image Metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
type=raw,value=latest,enable={{is_default_branch}}
-
name: Login to Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.USERNAME }}
password: ${{ env.TOKEN }}
-
name: Set up Buildx
uses: docker/setup-buildx-action@v2
-
name: Build and Push
uses: docker/build-push-action@v4
with:
context: .
file: ./Containerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
-
name: Docker Hub Description
uses: peter-evans/dockerhub-description@v5
with:
username: ${{ env.USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.TARGET }}