-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathDockerfile.remote-llvm-project-env
66 lines (58 loc) · 1.91 KB
/
Dockerfile.remote-llvm-project-env
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
# CLion remote docker environment for llvm-project
# (How to build docker container, run and stop it)
#
# Build and run:
# docker build --build-arg UID=$(id -u) --build-arg GID=$(id -g) -t clion/remote-ubuntu:20.04 -f Dockerfile.remote-llvm-project-env /path/to/llvm-project
# docker run -d --cap-add sys_ptrace -p127.0.0.1:2222:22 clion/remote-ubuntu:20.04
# ssh-keygen -f "$HOME/.ssh/known_hosts" -R "[localhost]:2222"
#
# stop: docker stop <container_name>
#
# ssh credentials:
# username: user
# password: 1
FROM ubuntu:20.04
ARG UID=1001
ARG GID=1001
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y ssh \
tzdata \
build-essential \
gdb \
clang \
rsync \
tar \
python \
sudo \
make \
ninja-build \
cmake \
autoconf \
automake \
locales-all \
dos2unix \
&& apt-get clean
# CMake with Ninja Multi-Config Generator
RUN version=3.17.3; \
wget -O cmake-$version-Linux-x86_64.sh https://github.com/Kitware/CMake/releases/download/v$version/cmake-$version-Linux-x86_64.sh \
&& sh cmake-$version-Linux-x86_64.sh -- --skip-license --prefix=/usr \
&& rm -f cmake-$version-Linux-x86_64.sh
RUN ( \
echo 'LogLevel DEBUG2'; \
echo 'PermitRootLogin yes'; \
echo 'PasswordAuthentication yes'; \
echo 'Subsystem sftp /usr/lib/openssh/sftp-server'; \
) > /etc/ssh/sshd_config_test_clion \
&& mkdir /run/sshd
RUN groupadd -r --gid $GID user \
&& useradd --no-log-init --create-home -g user -r --uid $UID user \
&& yes 1 | passwd user \
&& mkdir -p /etc/sudoers.d \
&& echo "user ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user \
&& chmod 0440 /etc/sudoers.d/user
# DELETE
COPY . /home/user/llvm-project
RUN touch /home/user/llvm-project/llvm/.clion.source.upload.marker \
&& chown -R user:user /home/user/llvm-project
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config_test_clion"]