forked from postgrespro/testgres
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile--std-all.tmpl
More file actions
68 lines (51 loc) · 1.74 KB
/
Dockerfile--std-all.tmpl
File metadata and controls
68 lines (51 loc) · 1.74 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
ARG PG_VERSION
ARG PYTHON_VERSION
# --------------------------------------------- base1
FROM postgres:${PG_VERSION}-alpine AS base1
# --------------------------------------------- base2_with_python-3
FROM base1 AS base2_with_python-3
RUN apk add --no-cache curl python3 python3-dev build-base musl-dev linux-headers
ENV PYTHON_BINARY=python3
# --------------------------------------------- final
FROM base2_with_python-${PYTHON_VERSION} AS final
#RUN apk add --no-cache mc
RUN apk add --no-cache git
# Full version of "ps" command
RUN apk add --no-cache procps
RUN apk add --no-cache openssh
RUN apk add --no-cache sudo
ENV LANG=C.UTF-8
RUN addgroup -S sudo
RUN adduser -D test
RUN addgroup test sudo
EXPOSE 22
RUN ssh-keygen -A
ADD --chown=test:test . /home/test/testgres
WORKDIR /home/test/testgres
RUN mkdir /home/test/testgres/logs
RUN chown -R test:test /home/test/testgres/logs
# It allows to use sudo without password
RUN echo "test ALL=(ALL:ALL) NOPASSWD:ALL" >> /etc/sudoers
# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
RUN echo "test:*" | chpasswd -e
USER test
# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
RUN chmod 700 ~/
RUN mkdir -p ~/.ssh
#RUN chmod 700 ~/.ssh
#ENTRYPOINT PYTHON_VERSION=${PYTHON_VERSION} bash run_tests.sh
ENTRYPOINT sh -c " \
set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
ls -la .; \
ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \
chmod 600 ~/.ssh/authorized_keys; \
ls -la ~/.ssh/; \
sudo /usr/sbin/sshd; \
sudo chmod 777 /home/test/testgres/logs; \
ls -la . | grep logs; \
ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \
ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \
TEST_FILTER=\"\" bash run_tests.sh;"