forked from klo2k/nexus3-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (50 loc) · 1.8 KB
/
github_cache_warmer.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
46
47
48
49
50
51
52
53
54
55
56
57
# Workflow keeps the docker github cache active by building every week / on demand
# Github drops cache over 7 days old
# https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
name: GitHub Cache Warmer
on:
schedule:
# Run 05:00 UTC every TUE, FRI
- cron: "0 5 * * 2,5"
# On-demand push-button build, why not...
workflow_dispatch:
jobs:
get_latest_version:
uses: ./.github/workflows/get_nexus_version_latest.yml
build_image_to_cache:
runs-on: ubuntu-latest
needs: get_latest_version
steps:
- name: Checkout
uses: actions/checkout@v4
# Setup docker cache to keep warm
- name: Setup Docker build cache
uses: actions/cache@v3
with:
path: /tmp/buildx-cache
key: ${{runner.os}}-buildx-${{github.sha}}
restore-keys: |
${{runner.os}}-buildx-
# Enable multi-architecture support on build node
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: all
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
- name: Build to GitHub cache (keep it warm)
env:
NEXUS_VERSION: ${{needs.get_latest_version.outputs.nexus_version}}
run: |
docker buildx build \
--build-arg "NEXUS_VERSION=${NEXUS_VERSION}" \
--cache-from type=local,src=/tmp/buildx-cache \
--cache-to type=local,dest=/tmp/buildx-cache \
--label org.opencontainers.image.revision="${{github.sha}}" \
--label org.opencontainers.image.version="${NEXUS_VERSION}" \
--platform "linux/arm/v7,linux/arm64" \
--pull \
--output "type=image,push=false" \
--file ./Dockerfile .