-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile--alpine.tmpl
More file actions
61 lines (44 loc) · 1.4 KB
/
Dockerfile--alpine.tmpl
File metadata and controls
61 lines (44 loc) · 1.4 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
ARG PYTHON_VERSION
# --------------------------------------------- base1
FROM python:${PYTHON_VERSION}-alpine AS base1
# --------------------------------------------- base1
FROM base1 AS base2
RUN apk add python3-dev build-base musl-dev linux-headers
RUN apk add git
# --------------------------------------------- final
FROM base2 AS final
RUN apk add mc
RUN apk add bash
# Full version of "ps" command
RUN apk add --no-cache procps
RUN apk add --no-cache openssh
RUN apk add --no-cache sudo
RUN adduser -D test
RUN addgroup -S sudo
RUN adduser test sudo
EXPOSE 22
RUN ssh-keygen -A
ADD --chown=test:test . /home/test/testgres
WORKDIR /home/test/testgres
# 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 sh -c "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 sh -c " \
set -eux; \
echo HELLO FROM ENTRYPOINT; \
echo HOME DIR IS [`realpath ~/`]; \
echo WORK DIR IS [$(pwd)]; \
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; \
ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \
ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \
bash run_tests3.sh;"