Skip to content

Commit 90608cf

Browse files
authored
ci(build-docker): rename docker image to xs-env (#58)
1 parent ee3b8b5 commit 90608cf

File tree

2 files changed

+76
-4
lines changed

2 files changed

+76
-4
lines changed

.github/workflows/build-docker.yml

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches: [ master ]
66

77
jobs:
8-
build:
8+
build-ubuntu:
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: read
@@ -18,14 +18,20 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v4
2020

21+
- name: Get current date
22+
id: date
23+
run: |
24+
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
25+
2126
- uses: docker/metadata-action@v5
2227
id: metadata
2328
with:
2429
images: |
25-
ghcr.io/${{ github.repository_owner }}/ubuntu-${{ matrix.version }}
30+
ghcr.io/${{ github.repository_owner }}/xs-env
2631
tags: |
27-
latest
28-
${{ matrix.version }}
32+
${{ matrix.version == '24.04' && 'latest' || '' }}
33+
ubuntu-${{ matrix.version }}
34+
ubuntu-${{ matrix.version }}-${{ env.DATE }}
2935
labels: |
3036
maintainer=${{ github.repository_owner }}
3137
@@ -46,3 +52,45 @@ jobs:
4652
labels: ${{ steps.metadata.outputs.labels }}
4753
build-args: |
4854
BASE_IMAGE=ubuntu:${{ matrix.version }}
55+
56+
build-centos7:
57+
runs-on: ubuntu-latest
58+
permissions:
59+
contents: read
60+
packages: write
61+
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- name: Get current date
66+
id: date
67+
run: |
68+
echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
69+
70+
- uses: docker/metadata-action@v5
71+
id: metadata
72+
with:
73+
images: |
74+
ghcr.io/${{ github.repository_owner }}/xs-env
75+
tags: |
76+
centos7
77+
centos7-${{ env.DATE }}
78+
labels: |
79+
maintainer=${{ github.repository_owner }}
80+
81+
- uses: docker/setup-buildx-action@v3
82+
83+
- uses: docker/login-action@v3
84+
with:
85+
registry: ghcr.io
86+
username: ${{ github.repository_owner }}
87+
password: ${{ secrets.GITHUB_TOKEN }}
88+
89+
- uses: docker/build-push-action@v6
90+
with:
91+
context: .
92+
platforms: linux/amd64
93+
push: true
94+
tags: ${{ steps.metadata.outputs.tags }}
95+
labels: ${{ steps.metadata.outputs.labels }}
96+
file: ./centos.Dockerfile

centos.Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM centos:7
2+
3+
# WARNING:
4+
# This Docker image is only for NEMU/SPIKE compilation.
5+
# You CANNOT use this image to BUILD XiangShan.
6+
7+
# use baseurl instead of mirrorlist
8+
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
9+
RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
10+
RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
11+
RUN yum clean all && yum makecache
12+
13+
RUN yum install -y centos-release-scl
14+
# use baseurl instead of mirrorlist in CentOS-SCLo-scl.repo
15+
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
16+
RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
17+
RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
18+
RUN yum clean all && yum makecache
19+
20+
RUN yum install -y git dtc devtoolset-11 llvm-toolset-7 bison flex
21+
RUN echo "source /opt/rh/devtoolset-11/enable" >> /etc/profile
22+
RUN echo "source /opt/rh/llvm-toolset-7/enable" >> /etc/profile
23+
24+
CMD [ "/bin/bash" ]

0 commit comments

Comments
 (0)