-
Notifications
You must be signed in to change notification settings - Fork 116
Expand file tree
/
Copy pathDockerfile.pypi
More file actions
45 lines (43 loc) · 2.23 KB
/
Dockerfile.pypi
File metadata and controls
45 lines (43 loc) · 2.23 KB
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
# Define the base image dynamically using build argument
ARG DISTRO=ubuntu:latest
FROM ${DISTRO} AS base
# Install dependencies based on the distribution
RUN \
# For Debian/Ubuntu
if [ -f /etc/debian_version ]; then \
apt-get update && \
apt-get install -y python3 python3-pip python3-venv git flake8 pylint python3-pytest python3-pexpect python3-setuptools python3-pyparsing vim procps sudo && \
apt-get clean; \
groupadd -f testuser; \
useradd -m -d /home/testuser -s /bin/bash -g testuser testuser; \
echo 'root:password' | chpasswd; \
echo 'testuser:password' | chpasswd; \
echo 'testuser ALL=(ALL:ALL) ALL' > /etc/sudoers.d/testuser && chmod 0440 /etc/sudoers.d/testuser; \
# For Fedora
elif [ -f /etc/fedora-release ]; then \
dnf install -y python3 python3-pip python3-pytest git flake8 pylint python3-pexpect python3-setuptools python3-pyparsing vim sudo; \
groupadd -f testuser; \
useradd -m -d /home/testuser -s /bin/bash -g testuser testuser; \
echo 'root:password' | chpasswd; \
echo 'testuser:password' | chpasswd; \
echo 'testuser ALL=(ALL:ALL) ALL' > /etc/sudoers.d/testuser && chmod 0440 /etc/sudoers.d/testuser; \
# For CentOS
elif [ -f /etc/centos-release ]; then \
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && \
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && \
yum install -y python3 python3-pip python3-pytest git vim sudo && \
yum install -y python3-devel gcc && \
python3 -m pip install flake8 pylint pexpect setuptools pyparsing; \
yum clean all; \
groupadd -f testuser; \
useradd -m -d /home/testuser -s /bin/bash -g testuser testuser; \
echo 'root:password' | chpasswd; \
echo 'testuser:password' | chpasswd; \
echo 'testuser ALL=(ALL:ALL) ALL' > /etc/sudoers.d/testuser && chmod 0440 /etc/sudoers.d/testuser; \
fi
# Keep same user/workdir defaults as the main Dockerfile
RUN mkdir /home/testuser/lshell && chown -R testuser:testuser /home/testuser/lshell
WORKDIR /home/testuser/lshell
ENV PYTHONPATH=/home/testuser/lshell
USER testuser
CMD ["bash"]