Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions python3/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/library/python:3.11-slim-bookworm
FROM docker.io/library/debian:bookworm-slim

# Do an initial clean up and general upgrade of the distribution
ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -8,12 +8,15 @@ RUN \
apt-get -y install \
build-essential \
bzip2 \
ca-certificates \
curl \
default-libmysqlclient-dev \
git \
libxmlsec1-dev \
pkgconf \
python3 \
python3-dev \
python3-venv \
util-linux \
xz-utils \
&& \
Expand All @@ -24,12 +27,20 @@ RUN \
ARG RUNAS_UID
ARG RUNAS_GID

# install default venv
RUN \
python3 -m venv /venv && \
/venv/bin/pip install --upgrade pip wheel setuptools

ENV VIRTUAL_ENV="/venv"
ENV PATH="/venv/bin:${PATH}"

# Set the default workdir
WORKDIR /venv

# Copy the startup script
RUN mkdir /container-init /container-init-post
COPY --chmod=0755 ./bin/entrypoint.sh /entrypoint.sh

# Set the default workdir
WORKDIR /opt

ENTRYPOINT ["/entrypoint.sh"]
CMD ["python3"]
4 changes: 2 additions & 2 deletions python3/bin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ then
echo "Switching to user $RUNAS_UID and group $RUNAS_GID"
groupadd -g $RUNAS_GID openconext
useradd -M -u $RUNAS_UID -g $RUNAS_GID openconext
PRIVDROP="setpriv --reuid=openconext --regid=openconext --reset-env --clear-groups"
PRIVDROP="runuser --user=openconext --group=openconext -- "
else
echo "Switching to user $RUNAS_UID"
useradd -M -u $RUNAS_UID openconext
PRIVDROP="setpriv --reuid=openconext --reset-env --clear-groups"
PRIVDROP="runuser --user=openconext -- "
fi
echo "Dropping privileges to $($PRIVDROP id -u):$($PRIVDROP id -g)"

Expand Down