Skip to content

Commit

Permalink
feat: 添加 loong64 架构
Browse files Browse the repository at this point in the history
  • Loading branch information
wojiushixiaobai committed Jan 9, 2025
1 parent d639f85 commit 1507b0d
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/build-loong64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build (linux/loong64)

on:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: '0 0 2 * *'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3

- name: Setup QEMU
run: docker run --rm --privileged ghcr.io/loong64/qemu-user-static --reset -p yes

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and Push Image
uses: docker/build-push-action@v6
with:
context: .
provenance: false
file: Dockerfile.loong64
platforms: linux/loong64
push: true
tags: |
ghcr.io/${{ github.repository }}:loong64
outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build
name: Auto Build

on:
push:
Expand Down
32 changes: 32 additions & 0 deletions Dockerfile.loong64
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ghcr.io/loong64/debian:trixie-slim AS builder

ARG DEPENDENCIES=" \
ca-certificates \
wget"

WORKDIR /opt

RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
set -ex \
&& rm -f /etc/apt/apt.conf.d/docker-clean \
&& echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' >/etc/apt/apt.conf.d/keep-cache \
&& apt-get update \
&& apt-get -y install --no-install-recommends ${DEPENDENCIES} \
&& apt-get download qemu-user qemu-user-static

COPY docker-entrypoint.sh /opt/

RUN set -ex \
&& wget https://github.com/multiarch/qemu-user-static/raw/master/containers/latest/register.sh \
&& wget https://github.com/qemu/qemu/raw/master/scripts/qemu-binfmt-conf.sh \
&& chmod +x *.sh

FROM ghcr.io/loong64/debian:trixie-slim

COPY --from=builder /opt/qemu*.deb /opt/
COPY --from=builder /opt/*.sh /

ENV QEMU_BIN_DIR=/usr/bin

ENTRYPOINT ["/docker-entrypoint.sh"]

0 comments on commit 1507b0d

Please sign in to comment.