napi-rs/.github/workflows/docker.yaml
2023-03-12 18:24:48 +08:00

86 lines
2.8 KiB
YAML

name: Docker nightly build
on:
schedule:
- cron: '0 0 1 * *'
workflow_dispatch:
jobs:
build_image:
name: Build nodejs-rust:lts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GH_CONTAINER_UNAME }}
password: ${{ secrets.GH_TOKEN }}
- name: Build and push alpine
uses: docker/build-push-action@v4
with:
file: alpine.Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine
- name: Build and push debian
uses: docker/build-push-action@v4
with:
file: debian.Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
- name: Install latest libc++-dev for cross build
uses: addnab/docker-run-action@v3
with:
image: node:lts-slim
options: '--platform linux/arm64 --user 0:0 -e GITHUB_TOKEN -v ${{ github.workspace }}/lib/llvm-15:/usr/lib/llvm-15'
run: >-
apt-get update &&
apt-get install -y wget gnupg2 &&
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - &&
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" >> /etc/apt/sources.list &&
echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" >> /etc/apt/sources.list &&
apt-get update &&
apt-get install libc++-15-dev libc++abi-15-dev -y --fix-missing --no-install-recommends &&
rm /usr/lib/llvm-15/lib/libc++abi.so
- name: Build and push debian aarch64 cross
uses: docker/build-push-action@v4
with:
file: debian-aarch64.Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-aarch64
context: .
- name: Cleanup
run: sudo rm -rf "${{ github.workspace }}/lib"
- name: Build and push debian with zig
uses: docker/build-push-action@v4
with:
file: debian-zig.Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian-zig
- name: Build and push alpine with zig
uses: docker/build-push-action@v4
with:
file: alpine-zig.Dockerfile
platforms: linux/amd64
push: true
tags: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine-zig