forked from ajilach/clamav-rest
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (38 loc) · 1.25 KB
/
build-image.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
44
45
---
name: Build and Publish ClamAV Image
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * 0'
env:
DOCKER_NAME: clamav-rest
IMAGE: clamav
GH_REPO: gsa-tts/clamav-rest
jobs:
build-clamav:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Get Date
shell: bash
id: date
run: |
echo "date=$(date +%Y%m%d)" >> $GITHUB_OUTPUT
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Docker Image
run: docker build . -t ${{ env.DOCKER_NAME }}:${{ steps.date.outputs.date }}
- name: Tag Image
run: |
docker tag ${{ env.DOCKER_NAME }}:${{ steps.date.outputs.date }} ghcr.io/${{ env.GH_REPO }}/${{ env.IMAGE }}:${{ steps.date.outputs.date }}
docker tag ${{ env.DOCKER_NAME }}:${{ steps.date.outputs.date }} ghcr.io/${{ env.GH_REPO }}/${{ env.IMAGE }}:latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push Image
run: docker push --all-tags ghcr.io/${{ env.GH_REPO }}/${{ env.IMAGE }}