Skip to content

Commit d29f4c7

Browse files
committed
[dockerfile] Fix container after moving urllib3 to pip
This dockerfile was not updated after the move from getting urllib3 via pip instead of through a system dependency with `apt`. The toolchain download needs to be moved to *after* we download all the Python dependencies with pip, so that this can continue to work. This commit performs this move, and also modifies the ownership of `/tools` so that the user can correctly install the toolchain later. We do not just create this file as root and give access to the dev user because the `get-toolchain.py` script depends on the presence of the directory to determine install vs. upgrade semantics. Signed-off-by: Alex Jones <[email protected]>
1 parent d4540e3 commit d29f4c7

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

util/container/Dockerfile

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,6 @@ RUN sed -i -e '/^$/d' -e '/^#/d' -e 's/#.*//' /tmp/apt-requirements.txt \
6363
&& apt-get clean; \
6464
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
6565

66-
# RISC-V device toolchain
67-
COPY util/get-toolchain.py /tmp/get-toolchain.py
68-
RUN /tmp/get-toolchain.py -r ${RISCV_TOOLCHAIN_TAR_VERSION} \
69-
&& rm -f /tmp/get-toolchain.py
70-
7166
# Install and configure clang and llvm tools for coverage measurements.
7267
# Note: Some commands listed below are missing in 13.0.1 and cause warnings during
7368
# build. These are kept intentionally since we plan to use them in the future, e.g.
@@ -143,6 +138,11 @@ RUN groupadd dev \
143138
&& usermod -p '*' dev \
144139
&& passwd -u dev
145140

141+
# Give the dev user access to `/tools` so they can install the toolchain later.
142+
RUN mkdir -p /tools \
143+
&& chown dev:dev /tools \
144+
&& chmod 775 /tools
145+
146146
# All subsequent steps are performed as user.
147147
USER dev:dev
148148

@@ -160,6 +160,11 @@ RUN python3 -m pip install --user -U pip "setuptools<66.0.0" \
160160
--no-warn-script-location \
161161
&& rm -f /tmp/python-requirements.txt
162162

163+
# Get the RISC-V device toolchain
164+
COPY --chown=dev:dev util/get-toolchain.py /tmp/get-toolchain.py
165+
RUN /tmp/get-toolchain.py -r ${RISCV_TOOLCHAIN_TAR_VERSION} \
166+
&& rm -f /tmp/get-toolchain.py
167+
163168
USER root:root
164169

165170
# Install bazel using bazelisk.

0 commit comments

Comments
 (0)