Add Python 2 & 3 Docker files for MediaGoblin hacking.
[mediagoblin.git] / Dockerfile-python2
1 # A Dockerfile for MediaGoblin hacking.
2
3 # docker build -t mediagoblin-python2 -f Dockerfile-python2 .
4 # docker build -t mediagoblin
5 # docker run -it -p 6543:6543 -v ~/ws/mediagoblin/mediagoblin:/opt/mediagoblin/mediagoblin -v ~/ws/mediagoblin/extlib:/opt/mediagoblin/extlib mediagoblin-python2
6 # docker stop [container-name/id]
7 # docker start [container-name/id]
8 # docker kill [container-name/id]
9
10 FROM debian:buster
11
12 # Install bootstrap and configure dependencies. Currently requires virtualenv
13 # rather than the more modern python3-venv (should be fixed).
14 RUN apt-get update && apt-get install -y \
15 automake \
16 git \
17 nodejs \
18 npm \
19 python-dev \
20 virtualenv
21
22 # Install make and runtime dependencies.
23 RUN apt-get install -y \
24 python-alembic \
25 python-celery \
26 python-jsonschema \
27 python-kombu \
28 python-lxml \
29 python-migrate \
30 python-py \
31 python-pytest \
32 python-pytest-xdist \
33 python-six \
34 python-sphinx \
35 python-webtest
36
37 # Install audio dependencies.
38 RUN apt-get install -y \
39 gstreamer1.0-libav \
40 gstreamer1.0-plugins-bad \
41 gstreamer1.0-plugins-base \
42 gstreamer1.0-plugins-good \
43 gstreamer1.0-plugins-ugly \
44 libsndfile1-dev \
45 python-gst-1.0 \
46 python-numpy \
47 python-scipy
48
49 # Install video dependencies.
50 RUN apt-get install -y \
51 gir1.2-gst-plugins-base-1.0 \
52 gir1.2-gstreamer-1.0 \
53 gstreamer1.0-tools \
54 python-gi
55
56 # Create working directory.
57 RUN mkdir /opt/mediagoblin
58 RUN chown -R www-data:www-data /opt/mediagoblin
59 WORKDIR /opt/mediagoblin
60
61 # Create /var/www because Bower writes some cache files into /var/www during
62 # make, failing if it doesn't exist.
63 RUN mkdir /var/www
64 RUN chown root:www-data /var/www
65 RUN chmod g+w /var/www
66
67 USER www-data
68
69 # Clone MediaGoblin for use during the install. Could alternately copy across
70 # just the files needed to run bootstrap/configure/make.
71 RUN git clone git://git.savannah.gnu.org/mediagoblin.git -b master .
72 RUN git submodule init && git submodule update
73
74 RUN ./bootstrap.sh
75 RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure
76 RUN make
77
78 # Re-run installation of Python dependencies - seems to install more things that
79 # didn't get installed with make. That shouldn't happen.
80 RUN ./bin/python setup.py develop --upgrade
81
82 # Only supported on Python 2.
83 RUN ./bin/pip install scikits.audiolab
84
85 # Patch to fix the config defaults that are failing at runtime. Needed here
86 # since we're running `dbupdate` during the Docker build.
87 COPY mediagoblin/init/config.py /opt/mediagoblin/mediagoblin/init/config.py
88
89 RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini
90 RUN echo '[[mediagoblin.media_types.video]]' >> mediagoblin.ini
91
92 RUN cat mediagoblin.ini
93
94 # Using default sqlite database for now.
95 RUN ./bin/gmg dbupdate
96
97 RUN ./bin/gmg adduser --username admin --password a --email admin@example.com
98 RUN ./bin/gmg makeadmin admin
99
100 RUN ./bin/pip freeze
101
102 USER root
103 RUN apt-get install -y \
104 curl \
105 python-mock
106 USER www-data
107
108 # You can change this to /bin/bash if you'd prefer a shell.
109 CMD ["./lazyserver.sh", "--server-name=broadcast"]