-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
35 lines (26 loc) · 972 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
34
35
FROM python:3.10
# Env & Arg variables
ARG USERNAME=pythonssh
ARG USERPASS=sshpass
# Apt update & apt install required packages
# whois: required for mkpasswd
RUN apt update && apt -y install openssh-server whois
# Add a non-root user & set password
RUN useradd -ms /bin/bash $USERNAME
# Set password for non-root user
RUN usermod --password $(echo "$USERPASS" | mkpasswd -s) $USERNAME
# Remove no-needed packages
RUN apt purge -y whois && apt -y autoremove && apt -y autoclean && apt -y clean
# Copy the entrypoint
COPY entrypoint.sh entrypoint.sh
RUN chmod +x /entrypoint.sh
# Create the ssh directory and authorized_keys file
USER $USERNAME
RUN mkdir /home/$USERNAME/.ssh && touch /home/$USERNAME/.ssh/authorized_keys
USER root
RUN mkdir -p /root/bsc-node/node/ && mkdir -p /root/base-node/node/data/ && mkdir -p /root/test-bsc-node/node/ && chmod -R 777 /root
# Set volumes
VOLUME /home/$USERNAME/.ssh
VOLUME /etc/ssh
# Run entrypoint
CMD ["/entrypoint.sh"]