-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile.sftp
More file actions
43 lines (32 loc) · 1.39 KB
/
Dockerfile.sftp
File metadata and controls
43 lines (32 loc) · 1.39 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
FROM amazeeio/commons as commons
FROM alpine:3.7
# User and Password creation
# Edit those variables for creating the User and the password
ENV SFTP_USER 'simon-test'
ENV SFTP_PASSWORD 'simon-test'
# TODO: If the password is empty the password authentication will be disabled and an SSH key
# will be loaded from the environment variable SFTP_PUBLICKEY
# ENV SFTP_PUBLICKEY 'ssh-rsa...'
# Copy env files
COPY .lagoon.env.* /
# Copying commons files
COPY --from=commons /lagoon /lagoon
COPY --from=commons /bin/fix-permissions /bin/ep /bin/docker-sleep /bin/
COPY --from=commons /sbin/tini /sbin/
# Installing sftp and creating configuration directories
RUN echo "@community http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
apk add --no-cache bash shadow@community openssh openssh-sftp-server && \
mkdir -p /var/run/sshd && \
mkdir -p /var/run/sftp && \
rm -f /etc/ssh/ssh_host_*key*
# workaround to not run the 10-passwd entrypoint
RUN rm /lagoon/entrypoints/10-passwd.sh
COPY sftp-container/init.sh /
RUN chmod +x init.sh && ./init.sh
COPY sftp-container/sshd_config /etc/ssh/sshd_config
COPY sftp-container/docker-entrypoint.sh /lagoon/entrypoints/70-sshd-start
RUN fix-permissions /run/
RUN fix-permissions /home/${SFTP_USER}/
EXPOSE 2222
ENTRYPOINT ["/sbin/tini", "--", "/lagoon/entrypoints.sh"]
CMD ["/usr/sbin/sshd", "-e", "-D", "-f", "/etc/ssh/sshd_config"]