-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.python311slim
49 lines (39 loc) · 1.48 KB
/
Dockerfile.python311slim
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
# Use the official Python 3.11 image as the base image
FROM python:3.11-slim
LABEL maintainer="[email protected]"
LABEL version="1.0.0"
LABEL description="Image for testing software that connects via ssh"
# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
# Install necessary packages (git, vim, rsync, curl, openssh-server, patch, build tools)
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
git \
vim \
rsync \
curl \
openssh-server \
patch \
build-essential \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Covalent and Covalent SSH Plugin
RUN pip install covalent covalent-ssh-plugin
# Create privilege separation directory
RUN mkdir /run/sshd
# Copy SSH key for authentication
ARG MY_SSH_KEY
# Create the .ssh directory and copy SSH key for authentication
RUN mkdir -p /root/.ssh \
&& echo "$MY_SSH_KEY" > /root/.ssh/authorized_keys \
&& chmod 700 /root/.ssh \
&& chmod 600 /root/.ssh/authorized_keys
# Set root password to 'root' and configure SSH
RUN echo 'root:root' | chpasswd
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's@session required pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd
RUN sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
# Expose port 22
EXPOSE 22
# Start SSH server
CMD ["/usr/sbin/sshd", "-D", "-e"]