Repository navigation
76 lines (62 loc) · 1.81 KB
/
Copy pathpackage.yml
File metadata and controls
76 lines (62 loc) · 1.81 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
name: Docker Build & Push
on:
push:
branches: [ dev ]
workflow_dispatch:
schedule:
- cron: "42 3 * * 2"
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
erc20-processor:
name: Build & Push ERC20 Processor
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install musl tools
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Install Rust musl target
run: rustup target add x86_64-unknown-linux-musl
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Build musl binary
run: |
cargo build \
--profile=release-lto \
--target=x86_64-unknown-linux-musl
- name: Prepare Docker context
run: |
mkdir docker
cp target/x86_64-unknown-linux-musl/release-lto/erc20-processor docker/
cat <<'EOF' > docker/Dockerfile
FROM alpine:latest
COPY erc20-processor /usr/local/bin/erc20-processor
ENTRYPOINT ["erc20-processor"]
EOF
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: docker
file: docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}