From 63a92e3bbd7aa4dc205a43d3542e85dc4e4965db Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Thu, 12 Sep 2019 20:23:08 +1000 Subject: [PATCH] Add Python 2 & 3 Docker files for MediaGoblin hacking. --- Dockerfile-python2 | 109 +++++++++++++++++++++++++++++++++++++++++++++ Dockerfile-python3 | 100 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 209 insertions(+) create mode 100644 Dockerfile-python2 create mode 100644 Dockerfile-python3 diff --git a/Dockerfile-python2 b/Dockerfile-python2 new file mode 100644 index 00000000..8ab28c0d --- /dev/null +++ b/Dockerfile-python2 @@ -0,0 +1,109 @@ +# A Dockerfile for MediaGoblin hacking. + +# docker build -t mediagoblin-python2 -f Dockerfile-python2 . +# docker build -t mediagoblin +# docker run -it -p 6543:6543 -v ~/ws/mediagoblin/mediagoblin:/opt/mediagoblin/mediagoblin -v ~/ws/mediagoblin/extlib:/opt/mediagoblin/extlib mediagoblin-python2 +# docker stop [container-name/id] +# docker start [container-name/id] +# docker kill [container-name/id] + +FROM debian:buster + +# Install bootstrap and configure dependencies. Currently requires virtualenv +# rather than the more modern python3-venv (should be fixed). +RUN apt-get update && apt-get install -y \ +automake \ +git \ +nodejs \ +npm \ +python-dev \ +virtualenv + +# Install make and runtime dependencies. +RUN apt-get install -y \ +python-alembic \ +python-celery \ +python-jsonschema \ +python-kombu \ +python-lxml \ +python-migrate \ +python-py \ +python-pytest \ +python-pytest-xdist \ +python-six \ +python-sphinx \ +python-webtest + +# Install audio dependencies. +RUN apt-get install -y \ +gstreamer1.0-libav \ +gstreamer1.0-plugins-bad \ +gstreamer1.0-plugins-base \ +gstreamer1.0-plugins-good \ +gstreamer1.0-plugins-ugly \ +libsndfile1-dev \ +python-gst-1.0 \ +python-numpy \ +python-scipy + +# Install video dependencies. +RUN apt-get install -y \ +gir1.2-gst-plugins-base-1.0 \ +gir1.2-gstreamer-1.0 \ +gstreamer1.0-tools \ +python-gi + +# Create working directory. +RUN mkdir /opt/mediagoblin +RUN chown -R www-data:www-data /opt/mediagoblin +WORKDIR /opt/mediagoblin + +# Create /var/www because Bower writes some cache files into /var/www during +# make, failing if it doesn't exist. +RUN mkdir /var/www +RUN chown root:www-data /var/www +RUN chmod g+w /var/www + +USER www-data + +# Clone MediaGoblin for use during the install. Could alternately copy across +# just the files needed to run bootstrap/configure/make. +RUN git clone git://git.savannah.gnu.org/mediagoblin.git -b master . +RUN git submodule init && git submodule update + +RUN ./bootstrap.sh +RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure +RUN make + +# Re-run installation of Python dependencies - seems to install more things that +# didn't get installed with make. That shouldn't happen. +RUN ./bin/python setup.py develop --upgrade + +# Only supported on Python 2. +RUN ./bin/pip install scikits.audiolab + +# Patch to fix the config defaults that are failing at runtime. Needed here +# since we're running `dbupdate` during the Docker build. +COPY mediagoblin/init/config.py /opt/mediagoblin/mediagoblin/init/config.py + +RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini +RUN echo '[[mediagoblin.media_types.video]]' >> mediagoblin.ini + +RUN cat mediagoblin.ini + +# Using default sqlite database for now. +RUN ./bin/gmg dbupdate + +RUN ./bin/gmg adduser --username admin --password a --email admin@example.com +RUN ./bin/gmg makeadmin admin + +RUN ./bin/pip freeze + +USER root +RUN apt-get install -y \ +curl \ +python-mock +USER www-data + +# You can change this to /bin/bash if you'd prefer a shell. +CMD ["./lazyserver.sh", "--server-name=broadcast"] diff --git a/Dockerfile-python3 b/Dockerfile-python3 new file mode 100644 index 00000000..c617e205 --- /dev/null +++ b/Dockerfile-python3 @@ -0,0 +1,100 @@ +# A Dockerfile for MediaGoblin hacking. + +# docker build -t mediagoblin-python3 -f Dockerfile-python3 . +# docker run -it -p 6543:6543 -v ~/ws/mediagoblin/mediagoblin:/opt/mediagoblin/mediagoblin -v ~/ws/mediagoblin/extlib:/opt/mediagoblin/extlib mediagoblin-python3 +# docker stop [container-name/id] +# docker start [container-name/id] +# docker kill [container-name/id] + +FROM debian:buster + +# Install bootstrap and configure dependencies. Currently requires virtualenv +# rather than the more modern python3-venv (should be fixed). +RUN apt-get update && apt-get install -y \ +automake \ +git \ +nodejs \ +npm \ +python3-dev \ +virtualenv + +# Install make and runtime dependencies. +RUN apt-get install -y \ +python3-alembic \ +python3-celery \ +python3-jsonschema \ +python3-kombu \ +python3-lxml \ +python3-migrate \ +python3-py \ +python3-pytest \ +python3-pytest-xdist \ +python3-six \ +python3-sphinx \ +python3-webtest + +# Install audio dependencies. +RUN apt-get install -y \ +gstreamer1.0-libav \ +gstreamer1.0-plugins-bad \ +gstreamer1.0-plugins-base \ +gstreamer1.0-plugins-good \ +gstreamer1.0-plugins-ugly \ +libsndfile1-dev \ +python3-gst-1.0 \ +python3-numpy \ +python3-scipy + +# Install video dependencies. +RUN apt-get install -y \ +gir1.2-gst-plugins-base-1.0 \ +gir1.2-gstreamer-1.0 \ +gstreamer1.0-tools \ +python3-gi + +# Create working directory. +RUN mkdir /opt/mediagoblin +RUN chown -R www-data:www-data /opt/mediagoblin +WORKDIR /opt/mediagoblin + +# Create /var/www because Bower writes some cache files into /var/www during +# make, failing if it doesn't exist. +RUN mkdir /var/www +RUN chown root:www-data /var/www +RUN chmod g+w /var/www + +USER www-data + +# Clone MediaGoblin for use during the install. Could alternately copy across +# just the files needed to run bootstrap/configure/make. +RUN git clone git://git.savannah.gnu.org/mediagoblin.git -b master . +RUN git submodule init && git submodule update + +RUN ./bootstrap.sh +RUN VIRTUALENV_FLAGS='--system-site-packages' ./configure --with-python3 +RUN make + +# Re-run installation of Python dependencies - seems to install more things that +# didn't get installed with make. That shouldn't happen. +RUN ./bin/python setup.py develop --upgrade + +# Only supported on Python 2. +# RUN ./bin/pip install scikits.audiolab + +# Patch to fix the config defaults that are failing at runtime. Needed here +# since we're running `dbupdate` during the Docker build. +COPY mediagoblin/init/config.py /opt/mediagoblin/mediagoblin/init/config.py + +RUN echo '[[mediagoblin.media_types.audio]]' >> mediagoblin.ini +RUN echo '[[mediagoblin.media_types.video]]' >> mediagoblin.ini + +RUN cat mediagoblin.ini + +# Using default sqlite database for now. +RUN ./bin/gmg dbupdate + +RUN ./bin/gmg adduser --username admin --password a --email admin@example.com +RUN ./bin/gmg makeadmin admin + +# You can change this to /bin/bash if you'd prefer a shell. +CMD ["./lazyserver.sh", "--server-name=broadcast"] -- 2.25.1