-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile.alpine
67 lines (57 loc) · 2.11 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
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
###########################################
# Official Image Alpine with OpenSSH server
# Allow SSH connection to the container
# Installed: openssh-server, mc, htop, zip,
# tar, iotop, ncdu, nano, vim, bash, sudo
# for net: ping, traceroute, telnet, host,
# nslookup, iperf, nmap
###########################################
ARG IMAGE_VERSION="alpine:3.20"
FROM $IMAGE_VERSION
# Label docker image
ARG IMAGE_VERSION
MAINTAINER DevDotNet.Org <anton@devdotnet.org>
LABEL maintainer="DevDotNet.Org <anton@devdotnet.org>"
LABEL build_version="Image version:- ${IMAGE_VERSION}"
# Base
# Set the locale
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8
# Password for ssh
ENV USER_PASSWORD=123456
# Copy to image
COPY copyables /
# Install
RUN apk update \
&& apk add --no-cache --upgrade openssh-server \
# Utils
&& apk add --no-cache --upgrade mc htop iotop ncdu tar zip nano vim bash sudo sed \
# Net utils
&& apk add --no-cache --upgrade iputils paris-traceroute perl-net-telnet bind-tools iperf nmap \
# Deleting keys
&& rm -rf /etc/ssh/ssh_host_dsa* /etc/ssh/ssh_host_ecdsa* /etc/ssh/ssh_host_ed25519* /etc/ssh/ssh_host_rsa* \
# Config SSH
&& sed -ri "s|^#PermitRootLogin|PermitRootLogin|" /etc/ssh/sshd_config \
&& sed -i "s|PermitRootLogin without-password|PermitRootLogin yes|" /etc/ssh/sshd_config \
&& sed -i "s|PermitRootLogin prohibit-password|PermitRootLogin yes|" /etc/ssh/sshd_config \
&& sed -ri "s|^#?PermitRootLogin\s+.*|PermitRootLogin yes|" /etc/ssh/sshd_config \
&& sed -ri "s|^#PasswordAuthentication|PasswordAuthentication|" /etc/ssh/sshd_config \
&& sed -ri "s|^PasswordAuthentication no|PasswordAuthentication yes|" /etc/ssh/sshd_config \
&& sed -ri "s|UsePAM yes|#UsePAM yes|g" /etc/ssh/sshd_config \
# Folder Data
&& mkdir -p /data \
#Cleaning
&& rm -rf /var/lib/{apt,dpkg,cache,log}/ \
&& rm -rf /var/lib/apt/lists/*.lz4 \
&& rm -rf /var/log/* \
&& rm -rf /tmp/* \
&& rm -rf /var/tmp/* \
&& rm -rf /usr/share/doc/ \
&& rm -rf /usr/share/man/ \
&& rm -rf /var/cache/apk/* \
&& rm -rf $HOME/.cache \
&& chmod +x /entrypoint.sh
# Port SSH
EXPOSE 22/tcp
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/usr/sbin/sshd", "-D"]