Skip to content

Commit

Permalink
feat: build docker
Browse files Browse the repository at this point in the history
支持 amd64、arm64、riscv64、loong64、i386

Log: build docker
  • Loading branch information
chenchongbiao committed Feb 9, 2024
0 parents commit 8ca73ec
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: build rootfs

on:
push:
branches: [ 'master' ]
paths:
- 'build.sh'
- 'Dockerfile'
pull_request:
branches: [ 'master' ]
paths:
- 'build.sh'
- 'Dockerfile'
workflow_dispatch:

jobs:
build:
name: Build tar file
runs-on: ubuntu-latest
strategy:
matrix:
arch: [ amd64, arm64, riscv64, loong64, i386 ]

steps:
- name: Read Rootfs version
run: |
echo "ROOTFS_VERSION=$(curl -s https://raw.githubusercontent.com/deepin-community/deepin-rootfs/master/version.txt | cat)" >> $GITHUB_ENV
shell: bash
env:
GITHUB_ENV: ${{ env.GITHUB_ENV }}

- name: Checkout repository
uses: actions/checkout@v4

- name: Run build.sh
run: |
sudo bash build.sh "v${{ env.ROOTFS_VERSION }}" ${{ matrix.arch }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Docker image push
run: |
docker push chenchongbiao/deepin:beige-${{ matrix.arch }}-"v${{ env.ROOTFS_VERSION }}"
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM scratch

ARG ROOTFS_URL
ADD $ROOTFS_URL /

CMD ["bash"]
Empty file added README.md
Empty file.
13 changes: 13 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e -u -x

VERSION=$1
ARCH=$2
owner=chenchongbiao
ROOTFS_URL=https://github.com/deepin-community/deepin-rootfs/releases/download/${VERSION}/deepin-rootfs-${ARCH}.tar.gz
docker build --build-arg ROOTFS_URL=$ROOTFS_URL -t ${owner}/deepin:beige-${ARCH}-${VERSION} .

if [ "${ARCH}" = amd64 ]; then
docker tag ${owner}/deepin:beige-${ARCH}-${VERSION} "${owner}/deepin:beige"
fi

0 comments on commit 8ca73ec

Please sign in to comment.