File: start_website_in_docker-Dockerfile.in

package info (click to toggle)
datalad 1.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,148 kB
  • sloc: python: 69,414; sh: 1,521; makefile: 220
file content (73 lines) | stat: -rw-r--r-- 2,636 bytes parent folder | download | duplicates (3)
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
FROM neurodebian:DL_DIST
MAINTAINER Yaroslav Halchenko <yoh@datalad.org>

USER root

# Speed up installation using our apt cacher
#RUN mkdir /etc/apt/apt.conf.d/
COPY conf/etc/apt/apt.conf.d/99apt-cacher /etc/apt/apt.conf.d/99apt-cacher
RUN chmod a+r /etc/apt/apt.conf.d/99apt-cacher

# Make deb-src avail
RUN sed -i -e 's,^deb\(.*\),deb\1\ndeb-src\1,g' /etc/apt/sources.list.d/neurodebian.sources.list /etc/apt/sources.list

# Assure popcon doesn't kick in
RUN bash -c "echo 'debconf debconf/frontend select noninteractive' | debconf-set-selections -"

RUN apt-get update
# Use bash for extended syntax
RUN apt-get install -y -q eatmydata
RUN bash -c "DL_APT"
# Some rudimentary tools if we need to do anything within docker
RUN bash -c "eatmydata apt-get install -y -q vim less man-db"
RUN apt-get clean

# Let's setup user matching user
RUN groupadd --gid DL_GID -r DL_USER && useradd -m --uid DL_UID -g DL_USER DL_USER

# Install and configure apache
RUN eatmydata apt-get update && eatmydata apt-get install -y --force-yes apache2

# Install and configure openssh server
RUN eatmydata apt-get install -q -y openssh-server

RUN chown DL_USER -R /var/www/html

USER DL_USER

WORKDIR /home/DL_USER
# Prepare system for working with Git
RUN git config --global user.email "DL_GIT_USER_EMAIL"
RUN git config --global user.name "DL_GIT_USER_NAME"
# RUN git clone https://github.com/datalad/datalad
RUN mkdir datalad

# WORKDIR /home/DL_USER/datalad

#
# Need to clone and install datalad system-wide but there is a problem that
# we can't mount hostdir at build time:
# https://github.com/docker/docker/issues/14080
# http://stackoverflow.com/questions/26050899/how-to-mount-host-volumes-into-docker-containers-in-dockerfile-during-build
# so this will not be done now but rather will be done once container started
# from this image
# Probably actually better so image could be reused for multiple instances of the container
#

# Fall back to root, so we have full control to start webserver etc
USER root

RUN mkdir /home/DL_USER/.ssh
COPY conf/authorized_keys /home/DL_USER/.ssh/authorized_keys
RUN bash -c "chown DL_USER -R /home/DL_USER/.ssh; chmod go-rwx -R /home/DL_USER/.ssh"

# We will need a supervisor to run both apache and sshd
# based on https://docs.docker.com/engine/admin/using_supervisord/
RUN mkdir -p /var/lock/apache2 /var/run/apache2 /var/run/sshd /var/log/supervisor
RUN eatmydata apt-get install -y -q supervisor
COPY conf/apache-ssh-supervisor.conf /etc/supervisor/conf.d/supervisord.conf

# ENTRYPOINT ["/usr/sbin/apache2ctl", "-D", "FOREGROUND"]
RUN apt-get clean
EXPOSE 22 80 443
CMD ["/usr/bin/supervisord"]