Skip to content
Open
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
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ jobs:
python: "3"
postgres: "17"
case_suffix: "py3_xx_xx-pg17_xx"
- platform: "ubuntu_26_04"
python: "3.12"
postgres: "17"
case_suffix: "py3_12_xx-pg17_xx"
- platform: "altlinux_10"
python: "3"
postgres: "17"
Expand Down
131 changes: 131 additions & 0 deletions Dockerfile--ubuntu_26_04.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
ARG PG_VERSION=17
ARG PYTHON_VERSION=3.12

# --------------------------------------------- base1
FROM ubuntu:26.04 AS base1
ARG PG_VERSION

# Disable interactive apt questions so that the build doesn't hang when setting time zones
ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends \
sudo \
curl \
ca-certificates \
openssh-server \
sshpass \
time \
netcat-traditional \
iproute2 \
git \
postgresql-common \
libpq-dev \
build-essential \
# FIX FOR TestOsOpsCommon::test_mkdir__mt[remote_ops] \
# INFO [2026-07-14 11:12:31] [Worker #3] Number 0 is reserved! \
# INFO [2026-07-14 11:12:31] [Worker #0] Number 0 is reserved! \
# Returning classic GNU coreutils instead of the default Rust/uutils \
&& apt-get install -y --allow-remove-essential coreutils-from-gnu coreutils-from-uutils- \
&& rm -rf /var/lib/apt/lists/*

RUN sed -i 's/#MaxStartups 10:30:100/MaxStartups 2000:30:2000/' /etc/ssh/sshd_config && \
sed -i 's/#MaxSessions 10/MaxSessions 500/' /etc/ssh/sshd_config && \
sed -i 's/#MaxAuthTries 6/MaxAuthTries 20/' /etc/ssh/sshd_config

RUN bash /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y

RUN install -d /usr/share/postgresql-common/pgdg
RUN curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc

RUN apt-get update && apt-get install -y --no-install-recommends \
postgresql-${PG_VERSION}

# --------------------------------------------- base2_with_python-3
FROM base1 AS base2_with_python-3

RUN apt-get update && apt-get install -y --no-install-recommends \
python3 \
python3-dev \
python3-venv \
&& rm -rf /var/lib/apt/lists/*

ENV PYTHON_BINARY=python3

# --------------------------------------------- base2_with_python-3.12
FROM base1 AS base2_with_python-3.12

RUN apt-get update && apt-get install -y --no-install-recommends \
software-properties-common \
gnupg \
&& add-apt-repository -y ppa:deadsnakes/ppa \
&& apt-get update && apt-get install -y --no-install-recommends \
python3.12 \
python3.12-venv \
python3.12-dev \
&& rm -rf /var/lib/apt/lists/*

ENV PYTHON_BINARY=/usr/bin/python3.12

# --------------------------------------------- final
FROM base2_with_python-${PYTHON_VERSION} AS final

EXPOSE 22
RUN ssh-keygen -A

RUN useradd -m test && usermod -aG postgres test

# It enables execution of "sudo service ssh start" without password
RUN echo "test ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers

COPY --chown=test:test . /home/test/testgres
WORKDIR /home/test/testgres

ENV LANG=C.UTF-8

RUN chmod 700 /home/test/ && \
mkdir -p /home/test/.ssh && \
echo 'Host *' > /home/test/.ssh/config && \
echo ' ControlMaster auto' >> /home/test/.ssh/config && \
echo ' ControlPath /home/test/.ssh/master-%r@%h:%p' >> /home/test/.ssh/config && \
echo ' ControlPersist 30m' >> /home/test/.ssh/config && \
echo ' StrictHostKeyChecking no' >> /home/test/.ssh/config && \
echo ' UserKnownHostsFile /dev/null' >> /home/test/.ssh/config && \
echo ' GSSAPIAuthentication no' >> /home/test/.ssh/config && \
chown -R test:test /home/test/.ssh && \
chmod 700 /home/test/.ssh && \
chmod 600 /home/test/.ssh/config

#
# \"$@\"
# - quote is important!
# - "DUMMY-DUMMY-DUMMY" will be ignored. Do not ask me "why?". AXEZ.
#
ENTRYPOINT ["sh", "-c", " \
set -eux; \
echo 'SYSTEM START: PREPARING SSH'; \
service ssh start; \
ls -la /home/test/.ssh/; \
\"$@\" \
", "DUMMY-DUMMY-DUMMY"]

# Run tests by default (master machine role)
CMD ["bash", "-c", " \
set -eux; \
echo \"HOME DIR IS [`realpath ~/`]\"; \
echo \"WORK DIR IS [$(pwd)]\"; \
if [ ! -f /home/test/.ssh/id_rsa ]; then \
su test -c \"ssh-keygen -t rsa -f /home/test/.ssh/id_rsa -q -N ''\"; \
su test -c \"cat /home/test/.ssh/id_rsa.pub >> /home/test/.ssh/authorized_keys\"; \
chmod 600 /home/test/.ssh/authorized_keys; \
fi; \
ls -la /home/test/.ssh/; \
if [ -n \"${TEST_CFG__REMOTE_SSH_KEY:-}\" ]; then \
cp \"${TEST_CFG__REMOTE_SSH_KEY}\" \"${TEST_CFG__REMOTE_SSH_KEY}_ci\"; \
export TEST_CFG__REMOTE_SSH_KEY=\"${TEST_CFG__REMOTE_SSH_KEY}_ci\"; \
chown test:test \"${TEST_CFG__REMOTE_SSH_KEY}\"; \
chmod 600 \"${TEST_CFG__REMOTE_SSH_KEY}\"; \
ls -la /home/test/.ssh/; \
fi; \
ls -la ./; \
su test -c \"TEST_FILTER='' bash ./run_tests.sh\"; \
"]