|
| 1 | +FROM postgres:${PG_VERSION}-alpine |
| 2 | + |
| 3 | +ENV PYTHON=python${PYTHON_VERSION} |
| 4 | +RUN if [ "${PYTHON_VERSION}" = "2" ] ; then \ |
| 5 | + apk add --no-cache curl python2 python2-dev build-base musl-dev \ |
| 6 | + linux-headers py-virtualenv py-pip; \ |
| 7 | + fi |
| 8 | +RUN if [ "${PYTHON_VERSION}" = "3" ] ; then \ |
| 9 | + apk add --no-cache curl python3 python3-dev build-base musl-dev \ |
| 10 | + linux-headers py-virtualenv; \ |
| 11 | + fi |
| 12 | + |
| 13 | +#RUN apk add --no-cache mc |
| 14 | + |
| 15 | +# Full version of "ps" command |
| 16 | +RUN apk add --no-cache procps |
| 17 | + |
| 18 | +RUN apk add --no-cache openssh |
| 19 | +RUN apk add --no-cache sudo |
| 20 | + |
| 21 | +ENV LANG=C.UTF-8 |
| 22 | + |
| 23 | +RUN addgroup -S sudo |
| 24 | +RUN adduser postgres sudo |
| 25 | + |
| 26 | +EXPOSE 22 |
| 27 | +RUN ssh-keygen -A |
| 28 | + |
| 29 | +ADD . /pg/testgres |
| 30 | +WORKDIR /pg/testgres |
| 31 | +RUN chown -R postgres:postgres /pg |
| 32 | + |
| 33 | +# It allows to use sudo without password |
| 34 | +RUN sh -c "echo \"postgres ALL=(ALL:ALL) NOPASSWD:ALL\"">>/etc/sudoers |
| 35 | + |
| 36 | +# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD |
| 37 | +RUN sh -c "echo "postgres:*" | chpasswd -e" |
| 38 | + |
| 39 | +USER postgres |
| 40 | + |
| 41 | +# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD |
| 42 | +RUN chmod 700 ~/ |
| 43 | + |
| 44 | +RUN mkdir -p ~/.ssh |
| 45 | +#RUN chmod 700 ~/.ssh |
| 46 | + |
| 47 | +#ENTRYPOINT PYTHON_VERSION=${PYTHON_VERSION} bash run_tests.sh |
| 48 | + |
| 49 | +ENTRYPOINT sh -c " \ |
| 50 | +set -eux; \ |
| 51 | +echo HELLO FROM ENTRYPOINT; \ |
| 52 | +echo HOME DIR IS [`realpath ~/`]; \ |
| 53 | +ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \ |
| 54 | +cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \ |
| 55 | +chmod 600 ~/.ssh/authorized_keys; \ |
| 56 | +ls -la ~/.ssh/; \ |
| 57 | +sudo /usr/sbin/sshd; \ |
| 58 | +ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \ |
| 59 | +ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \ |
| 60 | +TEST_FILTER=\"\" PYTHON_VERSION=${PYTHON_VERSION} bash run_tests.sh;" |
0 commit comments