add bazelisk installation and setup non-root user

This commit is contained in:
Amar Mahmutbegovic
2025-02-06 00:19:24 +01:00
parent 7b1e600266
commit 9cc9cc7d73

View File

@@ -34,9 +34,24 @@ RUN wget https://github.com/renode/renode/releases/download/v1.15.0/renode-1.15.
# Add the toolchain and Renode bin directories to PATH
ENV PATH="/opt/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi/bin:/opt/renode_1.15.0_portable:${PATH}"
# Set the working directory
# Install Bazelisk (renamed as 'bazel')
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-amd64 \
&& chmod +x bazelisk-linux-amd64 \
&& mv bazelisk-linux-amd64 /usr/local/bin/bazel
# Create new user 'constexpr'
RUN useradd -m constexpr
# Create and set working directory, ensuring it is owned by constexpr
RUN mkdir -p /workspace && chown constexpr:constexpr /workspace
WORKDIR /workspace
# Switch to non-root user 'constexpr'
USER constexpr
# Run Bazel to trigger Bazelisk to download Bazel and its dependencies.
RUN bazel version
# Keep the container running
CMD ["sleep", "infinity"]