-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (40 loc) · 1.28 KB
/
docker.yml
File metadata and controls
42 lines (40 loc) · 1.28 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
name: Docker Image
on: workflow_dispatch
permissions:
contents: read
packages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Free up Runner Disk Space
run: |
docker system prune -af
sudo apt-get clean
- name: CheckOut Latest Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- id: tag
run: echo "RELEASE_NAME=$(date -u -d @$(git log -1 --format=%ct) +"%y%m%d")" >> "$GITHUB_OUTPUT"
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v3
- name: Docker Login
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: repo_name
run: echo "REPO_OWNER_LOWER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
- name: Build & Push to GHCR
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
cache-to: type=gha,mode=max
cache-from: type=gha
tags: |
ghcr.io/${{ steps.repo_name.outputs.REPO_OWNER_LOWER }}/ofly:latest
ghcr.io/${{ steps.repo_name.outputs.REPO_OWNER_LOWER }}/ofly:${{ steps.tag.outputs.RELEASE_NAME }}