-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile.remote-cpp-env
64 lines (54 loc) · 1.8 KB
/
Dockerfile.remote-cpp-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
# 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 .
# 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
RUN DEBIAN_FRONTEND="noninteractive" apt-get update && apt-get -y install tzdata
RUN apt-get update \
&& apt-get install -y ssh \
build-essential \
git \
libboost-all-dev \
libgmp-dev \
wget \
gdb \
rsync \
&& apt-get clean
ARG CMAKE_INSTALLER=cmake-3.21.4-linux-x86_64.sh
RUN \
wget https://github.com/Kitware/CMake/releases/download/v3.21.4/${CMAKE_INSTALLER} && \
chmod +x ${CMAKE_INSTALLER}
RUN ./${CMAKE_INSTALLER} --prefix=/usr/local --exclude-subdir
# unittest-cpp
RUN git clone https://github.com/unittest-cpp/unittest-cpp.git
WORKDIR /unittest-cpp/builds
RUN cmake ../
RUN cmake --build ./
RUN cmake --build ./ --target install
WORKDIR /
# google benchmark
RUN git clone https://github.com/google/benchmark.git
WORKDIR /benchmark
RUN cmake -E make_directory "build"
RUN cmake -E chdir "build" cmake -DBENCHMARK_DOWNLOAD_DEPENDENCIES=on -DCMAKE_BUILD_TYPE=Release ../
RUN cmake --build "build" --config Release
WORKDIR /
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 user \
&& yes password | passwd user
RUN usermod -s /bin/bash user
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config_test_clion"]