-
Notifications
You must be signed in to change notification settings - Fork 1
85 lines (70 loc) · 2.42 KB
/
Copy pathdockerimage.yml
File metadata and controls
85 lines (70 loc) · 2.42 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
80
81
82
83
84
85
name: Docker Image Testing
on:
pull_request:
paths:
- "Dockerfile"
- "build.sh"
- ".github/workflows/dockerimage.yml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IMAGE_NAME: node-minimal
permissions:
contents: read
jobs:
build:
strategy:
matrix:
os:
- ubuntu-24.04
- ubuntu-24.04-arm
platform:
- amd64
- arm64
exclude:
- os: ubuntu-24.04
platform: arm64
- os: ubuntu-24.04-arm
platform: amd64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: ccache
uses: hendrikmuhs/ccache-action@d62db5f07c26379fc4b4e0916f098a92573c3b03 # v1.2.23
with:
key: ${{ matrix.os }}-${{ matrix.platform }}
max-size: 10G
- name: Configure ccache
run: |
ccache --set-config=sloppiness=time_macros,locale,include_file_ctime,include_file_mtime
ccache --set-config=hash_dir=false
ccache -p
- name: Get latest node version
run: echo "LATEST_VERSION=$(curl -fsSLo- --compressed https://nodejs.org/dist/index.json | jq '.[].version' | tr -d '"' | tr -d 'v' | head -1)" >> "$GITHUB_ENV"
- name: Display Node Version
run: |
echo "Building Node.js version: $LATEST_VERSION"
- name: Build Node
run: |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
which gcc
./build.sh -n "$LATEST_VERSION"
ccache -s
cp "node-v${LATEST_VERSION}/out/Release/node" node
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Build Image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: .
platforms: linux/${{ matrix.platform }}
load: true
tags: ${{ env.IMAGE_NAME }}-${{ env.LATEST_VERSION }}
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}
- name: Test Image
run: docker run --rm "${IMAGE_NAME}-${LATEST_VERSION}" -e "console.log('Hello from Node.js ' + process.version)"