Skip to content

Commit 1264674

Browse files
image: setup a proper user before overriding PATH
1 parent 1ab8461 commit 1264674

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Dockerfile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,19 @@ RUN meson _build --prefix=/usr -Dgtk_doc=false -Dintrospection=disabled -Dbuild-
1212
RUN ninja -C _build
1313
RUN ninja -C _build install
1414

15+
# set up a user
16+
ARG HOST_USER_ID=5555
17+
ENV HOST_USER_ID ${HOST_USER_ID}
18+
RUN useradd -u $HOST_USER_ID -ms /bin/bash user
19+
20+
USER user
21+
WORKDIR /home/user
22+
23+
# install rust stable/nightly/beta/latest supported version
24+
1525
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none -y
16-
ENV PATH="$HOME/.cargo/bin/:${PATH}"
26+
ENV PATH="/home/user/.cargo/bin:${PATH}"
27+
1728
RUN rustup toolchain install stable --profile minimal --allow-downgrade -c clippy -c rustfmt
1829
RUN rustup toolchain install beta --profile minimal --allow-downgrade -c clippy -c rustfmt
1930
RUN rustup toolchain install nightly --profile minimal --allow-downgrade -c clippy -c rustfmt

0 commit comments

Comments
 (0)