-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.remote-cpp-env
More file actions
80 lines (63 loc) · 2.12 KB
/
Dockerfile.remote-cpp-env
File metadata and controls
80 lines (63 loc) · 2.12 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# CLion remote docker environment (How to build docker container, run and stop it)
#
# Build and run:
# docker build -t clion/remote-cpp-env:0.5 -f Dockerfile.remote-cpp-env . --build-arg ssh_pub_key="$(cat ~/.ssh/id_rsa.pub)"
# docker run -d --cap-add sys_ptrace -p127.0.0.1:2222:22 --name clion_remote_env clion/remote-cpp-env:0.5
# ssh-keygen -f "$HOME/.ssh/known_hosts" -R "[localhost]:2222"
#
# stop:
# docker stop clion_remote_env
#
# ssh credentials (test user):
# user@password
FROM ubuntu:20.04
ARG ssh_pub_key
RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get -y install tzdata
RUN apt-get update \
&& apt-get install -y ssh \
vim \
build-essential \
gcc \
g++ \
gdb \
clang \
cmake \
libgtest-dev \
rsync \
tar \
python \
software-properties-common \
sudo \
libboost-all-dev \
libpthread-stubs0-dev \
libssl-dev \
&& apt-get clean
RUN add-apt-repository ppa:ubuntu-toolchain-r/test \
&& apt-get update \
&& apt install -y gcc-11 g++-11 \
&& apt-get clean
RUN cd /usr/src/googletest && \
cmake . && \
cmake --build . --target install && \
cp /usr/src/googletest/lib/* /usr/lib
RUN wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -
RUN apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main' && apt-get update
RUN apt -y install cmake && apt -y install cmake-curses-gui
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 useradd -m cryptalgocpp \
&& yes password | passwd cryptalgocpp
RUN usermod -s /bin/bash cryptalgocpp
USER cryptalgocpp
RUN mkdir -p /home/cryptalgocpp/.ssh && \
cd /home/cryptalgocpp/ && \
touch .ssh/authorized_keys
RUN echo "$ssh_pub_key" > /home/cryptalgocpp/.ssh/authorized_keys && \
chmod 600 /home/cryptalgocpp/.ssh/authorized_keys
USER root
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config_test_clion"]