dockerfile for patchwork patch tracking software

Change-Id: I4095148d2c8a1b6ba9beafda053c38022b147819
changes/36/9136/1
Harald Welte 5 years ago
parent aa1ccdabb7
commit 934c181542
  1. 1
      patchwork/Dockerfile
  2. 47
      patchwork/Dockerfile.fdo
  3. 42
      patchwork/Dockerfile.upstream
  4. 10
      patchwork/docker-entrypoint.sh
  5. 82
      patchwork/production.py

@ -0,0 +1 @@
Dockerfile.fdo

@ -0,0 +1,47 @@
FROM debian
# freedesktop.org version of patchwork
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
git \
libjs-jquery \
python3 \
python3-celery \
python3-django \
python3-django-jsonfield \
python3-django-filters \
python3-djangorestframework \
python3-mysqldb \
python3-pip \
python3-psycopg2 \
python3-sqlparse \
wget && \
apt-get clean
RUN pip3 install drf-nested-routers
WORKDIR /opt
ARG VERSION_TAG=2.0.1
#RUN wget https://github.com/getpatchwork/patchwork/archive/v$VERSION_TAG.tar.gz && \
#tar xzf v$VERSION_TAG.tar.gz && \
#mv patchwork-$VERSION_TAG patchwork && \
#rm v$VERSION_TAG.tar.gz
RUN git clone https://github.com/dlespiau/patchwork
WORKDIR /opt/patchwork
COPY production.py patchwork/settings/production.py
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN mkdir -p /var/www/patchwork
VOLUME /var/www/patchwork
#RUN DJANGO_SECRET_KEY=foo python3 manage.py collectstatic
CMD /docker-entrypoint.sh

@ -0,0 +1,42 @@
FROM debian
# upstream version of patchwork
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
git \
libjs-jquery \
python3 \
python3-celery \
python3-django \
python3-django-filters \
python3-djangorestframework \
python3-mysqldb \
python3-psycopg2 \
python3-sqlparse \
wget && \
apt-get clean
WORKDIR /opt
ARG VERSION_TAG=2.0.1
RUN wget https://github.com/getpatchwork/patchwork/archive/v$VERSION_TAG.tar.gz && \
tar xzf v$VERSION_TAG.tar.gz && \
mv patchwork-$VERSION_TAG patchwork && \
rm v$VERSION_TAG.tar.gz
WORKDIR /opt/patchwork
COPY production.py patchwork/settings/production.py
COPY docker-entrypoint.sh /docker-entrypoint.sh
RUN mkdir -p /var/www/patchwork
VOLUME /var/www/patchwork
#RUN DJANGO_SECRET_KEY=foo python3 manage.py collectstatic
CMD /docker-entrypoint.sh

@ -0,0 +1,10 @@
#!/bin/sh
set -e
set -x
python3 manage.py check
python3 manage.py migrate
python3 manage.py collectstatic --noinput
python3 manage.py loaddata default_tags default_states
python3 manage.py runserver 0.0.0.0:8000

@ -0,0 +1,82 @@
"""
Sample production-ready settings for patchwork project.
Most of these are commented out as they will be installation dependent.
Design based on:
http://www.revsys.com/blog/2014/nov/21/recommended-django-project-layout/
"""
from __future__ import absolute_import
import os
import django
from .base import * # noqa
#
# Core settings
# https://docs.djangoproject.com/en/1.8/ref/settings/#core-settings
#
# Security
#
# You'll need to replace this to a random string. The following python code can
# be used to generate a secret key:
#
# import string, random
# chars = string.letters + string.digits + string.punctuation
# print repr("".join([random.choice(chars) for i in range(0,50)]))
SECRET_KEY = os.environ['DJANGO_SECRET_KEY']
# Email
#
# Replace this with your own details
EMAIL_HOST = os.getenv('EMAIL_HOST', 'localhost')
EMAIL_PORT = os.getenv('EMAIL_PORT', 25)
EMAIL_HOST_USER = os.getenv('EMAIL_HOST_USER', '')
EMAIL_HOST_PASSWORD = os.getenv('EMAIL_HOST_PASSWORD', '')
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'Patchwork <patchwork@lists.osmocom.org>'
SERVER_EMAIL = DEFAULT_FROM_EMAIL
NOTIFICATION_FROM_EMAIL = DEFAULT_FROM_EMAIL
ADMINS = (
('Holger Freyther', 'holger@freyther.de'),
('Holger Freyther', 'holger+p@freyther.de'),
)
# Database
#
# If you're using a postgres database, connecting over a local unix-domain
# socket, then the following setting should work for you. Otherwise,
# see https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': os.environ.get('DATABASE_NAME', ''),
'USER': os.environ.get('DATABASE_USER', ''),
'PASSWORD': os.environ.get('DATABASE_PASSWORD', ''),
'HOST': os.environ.get('DATABASE_HOST', ''),
'PORT': os.environ.get('DATABASE_PORT', ''),
},
}
#
# Static files settings
# https://docs.djangoproject.com/en/1.8/ref/settings/#static-files
# https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/#manifeststaticfilesstorage
#
STATIC_ROOT = os.environ.get('STATIC_ROOT', '/var/www/patchwork')
if django.VERSION >= (1, 7):
STATICFILES_STORAGE = \
'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
ALLOWED_HOSTS = ['*']
Loading…
Cancel
Save