-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy pathDockerfile-alpine
40 lines (34 loc) · 1.26 KB
/
Dockerfile-alpine
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
# CLion remote docker environment (How to build docker container, run and stop it)
#
# Build and run:
# docker build -t clion/remote-alpine:1.0 -f Dockerfile-alpine .
# docker run -d --cap-add sys_ptrace --privileged -p127.0.0.1:2222:22 clion/remote-alpine:1.0
# ssh-keygen -f "$HOME/.ssh/known_hosts" -R "[localhost]:2222"
#
# stop:
# docker stop clion_remote_env
#
# ssh credentials (test user):
# root@root
FROM alpine:3.7
RUN apk add --update openssh gcc g++ clang gdb cmake make ninja autoconf automake dos2unix tar rsync python3 \
&& rm -rf /tmp/* /var/cache/apk/*
RUN echo "root:root" | chpasswd
RUN ( \
echo 'Port 22'; \
echo '#AddressFamily any'; \
echo '#ListenAddress 0.0.0.0'; \
echo '#ListenAddress ::'; \
echo 'HostKey /etc/ssh/ssh_host_rsa_key'; \
echo 'HostKey /etc/ssh/ssh_host_dsa_key'; \
echo 'HostKey /etc/ssh/ssh_host_ecdsa_key'; \
echo 'HostKey /etc/ssh/ssh_host_ed25519_key'; \
echo 'PermitRootLogin yes'; \
echo '#PasswordAuthentication yes'; \
echo 'AuthorizedKeysFile .ssh/authorized_keys'; \
echo 'Subsystem sftp /usr/lib/ssh/sftp-server'; \
) > /etc/sshd_config_test_clion
RUN /usr/bin/ssh-keygen -A
RUN ssh-keygen -t rsa -b 4096 -f /etc/ssh/ssh_host_key
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D", "-f", "/etc/sshd_config_test_clion"]