-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #321 from henrybear327/ci/reduce_docker_image_size
CI: Generate Docker image with Alpine Linux
- Loading branch information
Showing
1 changed file
with
8 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,24 @@ | ||
FROM sysprog21/rv32emu-sail as base_sail | ||
FROM alpine:3.19 as base_gcc | ||
|
||
FROM ubuntu:22.04 as base_gcc | ||
|
||
# install extra packages for the emulator to compile with full capabilities correctly | ||
RUN apt-get update && \ | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y \ | ||
build-essential curl git && \ | ||
rm -rf /var/lib/apt/lists/* | ||
RUN apk add --update alpine-sdk git curl | ||
|
||
# copy in the source code | ||
WORKDIR /home/root/rv32emu | ||
COPY . . | ||
|
||
# generate execution file for rv32emu and rv_histogram | ||
RUN make | ||
RUN make ENABLE_SDL=0 | ||
RUN make tool | ||
|
||
FROM ubuntu:22.04 as final | ||
|
||
# set up the timezone | ||
ENV TZ=Asia/Taipei | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
FROM alpine:3.19 as final | ||
|
||
# copy in elf files and reference emulator | ||
WORKDIR /home/root/rv32emu | ||
# copy in elf files | ||
COPY ./build/*.elf /home/root/rv32emu/build/ | ||
COPY ./tests/arch-test-target/sail_cSim/riscv_sim_RV32 /home/root/rv32emu/tests/arch-test-target/sail_cSim/ | ||
|
||
# replace the emulator (riscv_sim_RV32) with the arch that the container can execute | ||
RUN rm /home/root/rv32emu/tests/arch-test-target/sail_cSim/riscv_sim_RV32 | ||
COPY --from=base_sail /home/root/riscv_sim_RV32 /home/root/rv32emu/tests/arch-test-target/sail_cSim/ | ||
|
||
# get rv32emu and rv_histogram binaries | ||
COPY --from=base_gcc /home/root/rv32emu/build/rv32emu /home/root/rv32emu/build/rv32emu | ||
COPY --from=base_gcc /home/root/rv32emu/build/rv_histogram /home/root/rv32emu/build/rv_histogram | ||
|
||
ENV PATH=/home/root/rv32emu/build:/home/root/rv32emu/tests/arch-test-target/sail_cSim:$PATH | ||
ENV PATH=/home/root/rv32emu/build:$PATH | ||
|
||
WORKDIR /home/root/rv32emu |