-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (62 loc) · 2.1 KB
/
build-push-database.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
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
name: Build and Push Database Docker Image
on:
workflow_dispatch:
workflow_call:
permissions:
packages: write
contents: read
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Get versions from __about__.py
id: get_version
run: |
python -c "
import os
def find_about_file(start_path='src'):
for root, dirs, files in os.walk(start_path):
if '__about__.py' in files:
return os.path.join(root, '__about__.py')
return None
about_file = find_about_file()
if about_file:
with open(about_file, 'r') as f:
exec(compile(f.read(), about_file, 'exec'), globals())
print(f'version=v{__version__}')
else:
print('Error: __about__.py not found')
" >> $GITHUB_OUTPUT
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
# list of Docker images to use as base name for tags
images: |
ghcr.io/h3xitsec/h3xrecon/database
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value=${{ steps.get_version.outputs.version }}
type=raw,value=latest
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push database image
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile.database
push: true
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64