Add Python 2 & 3 Docker files for MediaGoblin hacking.
[mediagoblin.git] / Dockerfile-python2
CommitLineData
63a92e3b
BS
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
10FROM debian:buster
11
12# Install bootstrap and configure dependencies. Currently requires virtualenv
13# rather than the more modern python3-venv (should be fixed).
14RUN apt-get update && apt-get install -y \
15automake \
16git \
17nodejs \
18npm \
19python-dev \
20virtualenv
21
22# Install make and runtime dependencies.
23RUN apt-get install -y \
24python-alembic \
25python-celery \
26python-jsonschema \
27python-kombu \
28python-lxml \
29python-migrate \
30python-py \
31python-pytest \
32python-pytest-xdist \
33python-six \
34python-sphinx \
35python-webtest
36
37# Install audio dependencies.
38RUN apt-get install -y \
39gstreamer1.0-libav \
40gstreamer1.0-plugins-bad \
41gstreamer1.0-plugins-base \
42gstreamer1.0-plugins-good \
43gstreamer1.0-plugins-ugly \
44libsndfile1-dev \
45python-gst-1.0 \
46python-numpy \
47python-scipy
48
49# Install video dependencies.
50RUN apt-get install -y \
51gir1.2-gst-plugins-base-1.0 \
52gir1.2-gstreamer-1.0 \
53gstreamer1.0-tools \
54python-gi
55
56# Create working directory.
57RUN mkdir /opt/mediagoblin
58RUN chown -R www-data:www-data /opt/mediagoblin
59WORKDIR /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.
63RUN mkdir /var/www
64RUN chown root:www-data /var/www
65RUN chmod g+w /var/www
66
67USER 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.
71RUN git clone git://git.savannah.gnu.org/mediagoblin.git -b master .
72RUN git submodule init && git submodule update
73
74RUN ./bootstrap.sh
75RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure
76RUN 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.
80RUN ./bin/python setup.py develop --upgrade
81
82# Only supported on Python 2.
83RUN ./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.
87COPY mediagoblin/init/config.py /opt/mediagoblin/mediagoblin/init/config.py
88
89RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini
90RUN echo '[[mediagoblin.media_types.video]]' >> mediagoblin.ini
91
92RUN cat mediagoblin.ini
93
94# Using default sqlite database for now.
95RUN ./bin/gmg dbupdate
96
97RUN ./bin/gmg adduser --username admin --password a --email admin@example.com
98RUN ./bin/gmg makeadmin admin
99
100RUN ./bin/pip freeze
101
102USER root
103RUN apt-get install -y \
104curl \
105python-mock
106USER www-data
107
108# You can change this to /bin/bash if you'd prefer a shell.
109CMD ["./lazyserver.sh", "--server-name=broadcast"]