-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (56 loc) · 1.73 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
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
66
FROM ubuntu:24.04
ARG USERNAME=ubuntu
ARG DEBIAN_FRONTEND=noninteractive
ARG UID=1000
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
SHELL ["/bin/bash", "-c"]
USER root
RUN \
apt-get update && \
apt-get --assume-yes install --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
git-lfs \
jq \
less \
libasio-dev \
libcurl4-openssl-dev \
libxml2 \
make \
nano \
openssh-client \
python3 \
python3-pip \
sudo \
unzip \
zip
# Install bazelisk
RUN curl --compressed --fail --silent --show-error --location --output /usr/bin/bazel \
"https://github.com/bazelbuild/bazelisk/releases/download/v1.21.0/bazelisk-linux-amd64" && \
echo "655a5c675dacf3b7ef4970688b6a54598aa30cbaa0b9e717cd1412c1ef9ec5a7 /usr/bin/bazel" > /tmp/bazelisk.sha256sum && \
sha256sum --check /tmp/bazelisk.sha256sum && \
rm /tmp/bazelisk.sha256sum && \
chmod +x /usr/bin/bazel
# Create the non-root user, with sudo privileges
RUN echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME
ENTRYPOINT ["/bin/bash"]
RUN dpkg-reconfigure debconf -f noninteractive -p critical && \
rm -f /etc/apt/apt.conf.d/docker-clean && \
mkdir -p /home/${USERNAME}/.cache /home/${USERNAME}/.ssh && \
chown -R ${USERNAME}:${USERNAME} /home/${USERNAME}
RUN mkdir /command_history
RUN mkdir /bazel_cache
RUN chown -R $UID:$UID /command_history
RUN chown -R $UID:$UID /bazel_cache
USER ${USERNAME}
WORKDIR /home/${USERNAME}
# Pre-download Bazel via Bazelisk
COPY .bazelversion /tmp/.bazelversion
RUN <<EOF0
touch /tmp/WORKSPACE
cd /tmp/ && bazel --version
EOF0