-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDockerfile
82 lines (65 loc) · 2.5 KB
/
Dockerfile
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# DOCKER-VERSION 1.0
# Base image for other DIT4C platform images
FROM debian:8
MAINTAINER [email protected]
# Directories that don't need to be preserved in images
VOLUME ["/var/cache/apt", "/tmp"]
# Allow HTTPS right from the start
RUN apt-get update && apt-get install -y apt-transport-https && apt-get clean
# Install Nginx repo
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-key 7BD9BF62 && \
echo "deb https://nginx.org/packages/debian/ jessie nginx" >> /etc/apt/sources.list && \
echo "deb-src https://nginx.org/packages/debian/ jessie nginx" >> /etc/apt/sources.list
# Install
# - sudo and passwd for creating user/giving sudo
# - supervisord for monitoring
# - nginx for reverse-proxying
# - patching dependencies
RUN apt-get update && apt-get install -y \
sudo passwd \
supervisor \
nginx \
vim nano curl wget tmux screen bash-completion man tar zip unzip \
patch && \
apt-get clean
# Install Git
RUN apt-get update && apt-get install -y git && apt-get clean
# Install gotty
RUN VERSION=v0.0.12 && \
curl -sL https://github.com/yudai/gotty/releases/download/$VERSION/gotty_linux_amd64.tar.gz \
| tar xzC /usr/local/bin
# Install EasyDAV dependencies
RUN apt-get update && \
apt-get install -y python-kid python-flup && \
apt-get clean
# Install EasyDAV
COPY easydav_fix-archive-download.patch /tmp/
RUN cd /opt && \
curl -sL https://koti.kapsi.fi/jpa/webdav/easydav-0.4.tar.gz | tar zxvf - && \
mv easydav-0.4 easydav && \
cd easydav && \
patch -p1 < /tmp/easydav_fix-archive-download.patch && \
cd -
# Log directory for easydav & supervisord
RUN mkdir -p /var/log/easydav /var/log/supervisor
# Add supporting files (directory at a time to improve build speed)
COPY etc /etc
COPY opt /opt
COPY var /var
# Check nginx config is OK
RUN nginx -t
EXPOSE 8080
# Run all processes through supervisord
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
RUN useradd -m researcher -s /bin/bash && \
gpasswd -a researcher sudo && \
passwd -d researcher && passwd -u researcher && \
rm ~researcher/.bashrc ~researcher/.bash_logout ~researcher/.profile && \
sed -i -e '/^PS1/s/^/#/' /etc/bash.bashrc && \
sed -i -e '/stdout.*uname/s/^/#/' /etc/pam.d/login && \
echo 'source /etc/profile.d/prompt.sh' >> /etc/bash.bashrc
RUN chown -R researcher /var/log/easydav /var/log/supervisor
# Logs do not need to be preserved when exporting
VOLUME ["/var/log"]
# Change MOTD
RUN sh -c '. /etc/os-release && echo "You are using $PRETTY_NAME | $HOME_URL" > /etc/motd'