-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
39 lines (31 loc) · 1.62 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Dockerfile for building an image to compile & run RISC-V programs
# we love Debian
FROM debian:buster-slim
# some arguments
ARG HOME_DIR=/root
ARG SYSYRT_REPO_URL=https://github.com/pku-minic/sysy-runtime-lib.git
ARG SYSYRT_REPO_PATH=${HOME_DIR}/sysy-runtime-lib
ARG SYSYRT_PATH=${HOME_DIR}/libsysy.a
ARG RISCV32_PATH=/opt/riscv
# change APT sources
# for Mainland China users only, otherwise you can delete the following lines
RUN echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian buster main contrib non-free" > /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian buster-updates main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list && \
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian-security/ buster/updates main contrib non-free" >> /etc/apt/sources.list
# install dependencies
RUN apt-get update && apt-get install -y \
build-essential git flex bison cmake qemu-user-static
# setup GitHub proxy
RUN git config --global url."https://hub.fastgit.org/".insteadOf "https://github.com/" && \
git config --global protocol.https.allow always
# pull SysY runtime library
RUN git clone --recursive --shallow-submodules --single-branch --depth 1 \
${SYSYRT_REPO_URL} ${SYSYRT_REPO_PATH}
RUN cp ${SYSYRT_REPO_PATH}/libsysy.a ${SYSYRT_PATH} && \
rm -rf ${SYSYRT_REPO_PATH}
# copy 32-bit RISC-V GNU toolchain from 'riscv32-toolchain'
COPY --from=maxxing/riscv32-toolchain ${RISCV32_PATH} ${RISCV32_PATH}
ENV RISCV=${RISCV32_PATH}
ENV PATH=$RISCV/bin:$PATH
WORKDIR ${HOME_DIR}