Skip to content

Commit

Permalink
init: add build dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Han Gao <gaohan@iscas.ac.cn>
  • Loading branch information
RevySR committed Mar 31, 2024
1 parent d24bf10 commit d842ec2
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: ci

on:
workflow_dispatch:
push:
branches:
- 'master'

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- platform: linux/amd64
arch_name: amd64
- platform: linux/riscv64
arch_name: riscv64

steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
build_date=$(date "+%Y.%m.%d")
echo "BUILD_DATE=${build_date}" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4

- name: Download Rootfs
run: |
#wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-${{ matrix.arch_name }}-root.tar.xz
wget -o ${{ matrix.arch_name }}.tar.xz \
https://cloud-images.ubuntu.com/mantic/current/mantic-server-cloudimg-${{ matrix.arch_name }}-root.tar.xz
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io/revyos
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: build
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: ${{ matrix.platform }}
build-args: |
arch_name=${{ matrix.arch_name }}
tags: |
revyos-kernel-builder:${{ matrix.arch_name }}-${{ env.BUILD_DATE }}
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM scratch

LABEL org.opencontainers.image.authors="gaohan@iscas.ac.cn"

ARG arch_name

ADD ${arch_name}.tar.xz /

RUN apt update && \
apt install -y gdisk dosfstools build-essential \
libncurses-dev gawk flex bison openssl libssl-dev tree \
dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf device-tree-compiler \
devscripts pahole bc rsync bash wget cpio sudo python-is-python3

RUN apt install -y nodejs

RUN ln -sf /bin/bash /bin/sh

CMD [ "/bin/bash" ]

0 comments on commit d842ec2

Please sign in to comment.