Skip to content

Commit 558fdad

Browse files
committed
feat(ci): update docker build scripts
1 parent 331b8ec commit 558fdad

File tree

4 files changed

+100
-7
lines changed

4 files changed

+100
-7
lines changed

.github/workflows/build-docker.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build docker image
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
packages: write
13+
14+
strategy:
15+
matrix:
16+
version: [20.04, 22.04, 24.04]
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- uses: docker/metadata-action@v5
22+
id: metadata
23+
with:
24+
images: |
25+
ghcr.io/${{ github.repository_owner }}/ubuntu-${{ matrix.version }}
26+
tags: |
27+
latest
28+
${{ matrix.version }}
29+
labels: |
30+
maintainer=${{ github.repository_owner }}
31+
32+
- uses: docker/setup-buildx-action@v3
33+
34+
- uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.repository_owner }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- uses: docker/build-push-action@v6
41+
with:
42+
context: .
43+
platforms: linux/amd64
44+
push: true
45+
tags: ${{ steps.metadata.outputs.tags }}
46+
labels: ${{ steps.metadata.outputs.labels }}
47+
build-args: |
48+
BASE_IMAGE=ubuntu:${{ matrix.version }}

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
ARG BASE_IMAGE=ubuntu:24.04
2+
FROM ${BASE_IMAGE}
3+
4+
RUN cd /bin && ln -sf bash sh
5+
6+
RUN apt update
7+
RUN apt install sudo -y
8+
RUN apt clean
9+
10+
COPY install-verilator.sh /tmp/install-verilator.sh
11+
COPY setup-tools.sh /tmp/setup-tools.sh
12+
RUN cd /tmp && bash ./setup-tools.sh
13+
14+
CMD [ "/bin/bash" ]

install-verilator.sh

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# https://verilator.org/guide/latest/install.html
22

3-
sudo apt-get install git help2man perl python3 make autoconf g++ flex bison clang
4-
sudo apt-get install libgoogle-perftools-dev numactl perl-doc
5-
sudo apt-get install libfl2 # Ubuntu only (ignore if gives error)
6-
sudo apt-get install libfl-dev # Ubuntu only (ignore if gives error)
7-
sudo apt-get install zlibc zlib1g zlib1g-dev # Ubuntu only (ignore if gives error)
3+
export DEBIAN_FRONTEND=noninteractive
4+
5+
apt-get install -y git help2man perl python3 make autoconf g++ flex bison clang
6+
apt-get install -y libgoogle-perftools-dev numactl perl-doc
7+
apt-get install -y libfl2 # Ubuntu only (ignore if gives error)
8+
apt-get install -y libfl-dev # Ubuntu only (ignore if gives error)
9+
apt-get install -y zlibc zlib1g zlib1g-dev # Ubuntu only (ignore if gives error)
810

911
git clone https://github.com/verilator/verilator
1012

@@ -19,6 +21,6 @@ autoconf # Create ./configure script
1921
# Configure and create Makefile
2022
./configure CC=clang CXX=clang++ LINK=clang++ # We use clang as default compiler
2123
make -j8 # Build Verilator itself
22-
sudo make install
24+
make install
2325

2426
verilator --version

setup-tools.sh

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,37 @@
11
# This script will setup tools used by XiangShan
22
# tested on ubuntu 20.04 Docker image
33

4+
# make apt non-interactive to avoid tzdata prompt
5+
export DEBIAN_FRONTEND=noninteractive
6+
47
apt update
5-
apt install proxychains4 shadowsocks-libev vim wget git tmux make gcc clang llvm time curl libreadline6-dev libsdl2-dev gcc-riscv64-linux-gnu openjdk-11-jre zlib1g-dev device-tree-compiler flex autoconf bison sqlite3 libsqlite3-dev zstd libzstd-dev
8+
apt install -y \
9+
proxychains4 \
10+
shadowsocks-libev \
11+
vim \
12+
wget \
13+
git \
14+
tmux \
15+
make \
16+
g++ \
17+
clang \
18+
llvm \
19+
time \
20+
curl \
21+
libreadline6-dev \
22+
libsdl2-dev \
23+
g++-riscv64-linux-gnu \
24+
openjdk-11-jre \
25+
zlib1g-dev \
26+
device-tree-compiler \
27+
flex \
28+
autoconf \
29+
bison \
30+
sqlite3 \
31+
libsqlite3-dev \
32+
zstd \
33+
libzstd-dev
34+
635
sh -c "curl -L https://github.com/com-lihaoyi/mill/releases/download/0.12.5/0.12.5 > /usr/local/bin/mill && chmod +x /usr/local/bin/mill"
736

837
# We need to use Verilator 4.204+, so we install Verilator manually

0 commit comments

Comments
 (0)