-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathDockerfileClientTest
44 lines (32 loc) · 1.4 KB
/
DockerfileClientTest
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
# Dockerfile for integration testing
#
# Not intended to be used for an actual setup
FROM golang:1.20
RUN apt-get update && apt-get install -y openssh-server
RUN mkdir /var/run/sshd
RUN echo 'root:password' | chpasswd
RUN sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /etc/ssh/sshd_config
# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile
# Setup user cert based ssh
ADD test/keys/server_ca.pub /etc/ssh/ca_user_key.pub
WORKDIR /app
COPY go.mod .
COPY go.sum .
# Download dependencies
RUN go mod download
# Copy source
COPY . .
# Build & set-up
RUN go build -buildvcs=false -o /usr/bin/sharkey-client github.com/square/sharkey/cmd/sharkey-client && \
cp test/integration/client_entry.sh /usr/bin/entrypoint.sh && \
chmod +x /usr/bin/entrypoint.sh
RUN echo "HostCertificate /etc/ssh/ssh_host_rsa_key-cert.pub" >> /etc/ssh/sshd_config
RUN echo "HostCertificate /etc/ssh/ssh_host_ecdsa_key-cert.pub" >> /etc/ssh/sshd_config
RUN echo "HostCertificate /etc/ssh/ssh_host_ed25519_key-cert.pub" >> /etc/ssh/sshd_config
RUN echo "TrustedUserCAKeys /etc/ssh/ca_user_key.pub" >> /etc/ssh/sshd_config
# Need to add ssh user for testing user certs
RUN useradd -ms /bin/bash alice
ENTRYPOINT ["/usr/bin/entrypoint.sh"]