Skip to content

Commit e2eb61a

Browse files
authored
Merge pull request #321 from henrybear327/ci/reduce_docker_image_size
CI: Generate Docker image with Alpine Linux
2 parents 664f90d + 49778e4 commit e2eb61a

File tree

1 file changed

+8
-22
lines changed

1 file changed

+8
-22
lines changed

Dockerfile

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,24 @@
1-
FROM sysprog21/rv32emu-sail as base_sail
1+
FROM alpine:3.19 as base_gcc
22

3-
FROM ubuntu:22.04 as base_gcc
4-
5-
# install extra packages for the emulator to compile with full capabilities correctly
6-
RUN apt-get update && \
7-
DEBIAN_FRONTEND=noninteractive apt-get install -y \
8-
build-essential curl git && \
9-
rm -rf /var/lib/apt/lists/*
3+
RUN apk add --update alpine-sdk git curl
104

115
# copy in the source code
126
WORKDIR /home/root/rv32emu
137
COPY . .
148

159
# generate execution file for rv32emu and rv_histogram
16-
RUN make
10+
RUN make ENABLE_SDL=0
1711
RUN make tool
1812

19-
FROM ubuntu:22.04 as final
20-
21-
# set up the timezone
22-
ENV TZ=Asia/Taipei
23-
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
13+
FROM alpine:3.19 as final
2414

25-
# copy in elf files and reference emulator
26-
WORKDIR /home/root/rv32emu
15+
# copy in elf files
2716
COPY ./build/*.elf /home/root/rv32emu/build/
28-
COPY ./tests/arch-test-target/sail_cSim/riscv_sim_RV32 /home/root/rv32emu/tests/arch-test-target/sail_cSim/
29-
30-
# replace the emulator (riscv_sim_RV32) with the arch that the container can execute
31-
RUN rm /home/root/rv32emu/tests/arch-test-target/sail_cSim/riscv_sim_RV32
32-
COPY --from=base_sail /home/root/riscv_sim_RV32 /home/root/rv32emu/tests/arch-test-target/sail_cSim/
3317

3418
# get rv32emu and rv_histogram binaries
3519
COPY --from=base_gcc /home/root/rv32emu/build/rv32emu /home/root/rv32emu/build/rv32emu
3620
COPY --from=base_gcc /home/root/rv32emu/build/rv_histogram /home/root/rv32emu/build/rv_histogram
3721

38-
ENV PATH=/home/root/rv32emu/build:/home/root/rv32emu/tests/arch-test-target/sail_cSim:$PATH
22+
ENV PATH=/home/root/rv32emu/build:$PATH
23+
24+
WORKDIR /home/root/rv32emu

0 commit comments

Comments
 (0)