-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDockerfile
33 lines (24 loc) · 816 Bytes
/
Dockerfile
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
FROM alpine:3.11.6
LABEL maintainer="Mark <mark.binlab@gmail.com>"
ARG HOME=/var/lib/bastion
ARG USER=bastion
ARG GROUP=bastion
ARG UID=4096
ARG GID=4096
ENV HOST_KEYS_PATH_PREFIX="/usr"
ENV HOST_KEYS_PATH="${HOST_KEYS_PATH_PREFIX}/etc/ssh"
COPY bastion /usr/sbin/bastion
RUN addgroup -S -g ${GID} ${GROUP} \
&& adduser -D -h ${HOME} -s /bin/ash -g "${USER} service" \
-u ${UID} -G ${GROUP} ${USER} \
&& sed -i "s/${USER}:!/${USER}:*/g" /etc/shadow \
&& set -x \
&& apk add --no-cache openssh-server \
&& echo "Welcome to Bastion!" > /etc/motd \
&& chmod +x /usr/sbin/bastion \
&& mkdir -p ${HOST_KEYS_PATH} \
&& mkdir /etc/ssh/auth_principals \
&& echo "bastion" > /etc/ssh/auth_principals/bastion
EXPOSE 22/tcp
VOLUME ${HOST_KEYS_PATH}
ENTRYPOINT ["bastion"]