summaryrefslogtreecommitdiffstats
path: root/src/tools/cargo/crates/cargo-test-support/containers/sshd/Dockerfile
blob: f2521277084ce300ae093834053c0528dac53e39 (plain)
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
FROM alpine:3.18

RUN apk add --no-cache openssh git
RUN ssh-keygen -A

RUN addgroup -S testuser && adduser -S testuser -G testuser -s /bin/ash
# NOTE: Ideally the password should be set to *, but I am uncertain how to do
# that in alpine. It shouldn't matter since PermitEmptyPasswords is "no".
RUN passwd -u testuser

RUN mkdir /repos && chown testuser /repos
COPY --chown=testuser:testuser bar /repos/bar
USER testuser
WORKDIR /repos/bar
RUN git config --global user.email "testuser@example.com" &&\
    git config --global user.name "Test User" &&\
    git init -b master . &&\
    git add Cargo.toml src &&\
    git commit -m "Initial commit" &&\
    mv .git ../bar.git &&\
    cd ../bar.git &&\
    git config --bool core.bare true &&\
    rm -rf ../bar
WORKDIR /
USER root

EXPOSE 22

ENTRYPOINT ["/usr/sbin/sshd", "-D", "-E", "/var/log/auth.log"]