-
Notifications
You must be signed in to change notification settings - Fork 3
79 lines (69 loc) · 2.33 KB
/
Copy pathrefresh-docker-cache.yml
File metadata and controls
79 lines (69 loc) · 2.33 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
77
78
79
name: Build Docker Image
# This job builds the docker image, to refresh docker's caches.
# It does not publish the new image.
on:
push:
branches:
- main
jobs:
build_image:
name: Build Docker image
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: "ubuntu-22.04"
platform: linux/amd64
rust_target: x86_64-unknown-linux-musl
- os: "ubuntu-22.04"
platform: linux/arm64
rust_target: aarch64-unknown-linux-musl
permissions:
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@5138f76647652447004da686b2411557eaf65f33
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: sundaeswap/butane-oracle
- name: Install toolchain
run: |
rustup target install ${{ matrix.rust_target }}
sudo apt install musl-tools
- name: Install ARM toolchain
if: matrix.rust_target == 'aarch64-unknown-linux-musl'
run: |
sudo apt install gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
echo "CC=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
- name: Cargo Cache
id: cache
uses: actions/cache@v4
with:
path: |
cargo-registry-cache
sccache-cache
key: ${{ matrix.rust_target }}-cargo-cache-${{ github.sha }}
restore-keys: |
${{ matrix.rust_target }}-cargo-cache
- name: Compile
run: cargo build --release --target ${{ matrix.rust_target }}
- name: Build Docker image
id: build
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
cache-from: type=gha
cache-to: type=gha,mode=max
context: .
file: ./prebuilt.Dockerfile
outputs: type=image
platforms: ${{ matrix.platform }}
build-args: |
RUST_TARGET=${{ matrix.rust_target }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}