-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathDockerfile.riscv-toolchain
More file actions
executable file
·65 lines (51 loc) · 2.04 KB
/
Dockerfile.riscv-toolchain
File metadata and controls
executable file
·65 lines (51 loc) · 2.04 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM public.ecr.aws/lts/ubuntu:22.04_stable AS builder
ARG DEBIAN_FRONTEND=noninteractive
ARG KEYRING_PATH=/usr/share/keyrings
ARG APT_SOURCES_PATH=/etc/apt/sources.list.d
# update and upgrade
RUN apt update && apt upgrade -y
# install essentialls
RUN apt update && \
apt install -y \
man make build-essential git zsh vim curl wget procps gnupg gnupg2 ca-certificates zip \
software-properties-common
# unminimize the system
RUN bash -c "yes | unminimize"
# create dev sudo user
RUN useradd --create-home dev && \
usermod --append --groups sudo dev && \
apt update && apt install -y sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# build riscv toolchain
RUN sudo apt-get install -y \
autoconf automake autotools-dev curl python3 libmpc-dev libmpfr-dev libgmp-dev gawk \
build-essential bison flex texinfo gperf libtool patchutils bc zlib1g-dev libexpat-dev && \
cd /tmp && \
git clone --recursive https://github.com/riscv/riscv-gnu-toolchain.git && \
git clone --recursive https://github.com/riscv/riscv-opcodes.git && \
cd riscv-gnu-toolchain && \
./configure --prefix=/opt/riscv --with-arch=rv32i --with-abi=ilp32 && \
sudo make
# main image stage
FROM public.ecr.aws/lts/ubuntu:22.04_stable
ARG DEBIAN_FRONTEND=noninteractive
ARG KEYRING_PATH=/usr/share/keyrings
ARG APT_SOURCES_PATH=/etc/apt/sources.list.d
# update and upgrade
RUN apt update && apt upgrade -y
# install essentialls
RUN apt update && \
apt install -y \
man make build-essential git zsh vim curl wget procps gnupg gnupg2 ca-certificates zip \
software-properties-common
# unminimize the system
RUN bash -c "yes | unminimize"
# create dev sudo user
RUN useradd --create-home dev && \
usermod --append --groups sudo dev && \
apt update && apt install -y sudo && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
# get toolchain artifacts from builder stage
COPY --from=builder /opt/riscv /opt/riscv
ENV PATH="/opt/riscv/bin:${PATH}"
USER dev