commit 9278a9827ca1a4c6899481c9ea3db97d99aac3a4 Author: Carl Kittelberger Date: Sun Aug 14 00:33:22 2016 +0200 Initial commit. diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..85ed1e4 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.git* +.*ignore +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..bbdad4f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,80 @@ +FROM alpine:3.4 + +# We're using the hotfix branch since master does not work! +ARG DUDEL_VERSION=5b9b538e942debb05e168cf07fe238d169d1c586 +ARG COFFEESCRIPT_VERSION=1.10.0 +ARG SASS_VERSION=3.4.22 + +WORKDIR /app/ + +# Permanent dependencies +RUN \ + apk add --no-cache \ + gettext \ + libldap \ + libpq \ + libsasl \ + nodejs-lts \ + python \ + uwsgi \ + uwsgi-python \ + ruby +RUN gem install --no-ri --no-rdoc sass -v "$SASS_VERSION" +RUN npm install -g "coffee-script@$COFFEESCRIPT_VERSION" + +# Dudel source code +ADD "https://github.com/opatut/dudel/archive/${DUDEL_VERSION}.tar.gz" /tmp/dudel.tar.gz +RUN \ + apk add --no-cache --virtual .builddeps \ + gzip \ + tar \ + &&\ + tar xzf /tmp/dudel.tar.gz --strip-components=1 &&\ + rm /tmp/dudel.tar.gz &&\ + apk del .builddeps + +# Apply code patches +ADD patches/ /tmp/patches +RUN \ + cat /tmp/patches/*.patch | patch -p1 &&\ + rm -rf /tmp/patches + +# Build-time dependencies and build process itself +RUN \ + mkdir -p /data &&\ + mv config.py.example /data/config.py &&\ + sed -i 's,sqlite:///tmp/dudel.db,sqlite:////data/dudel.db,g' /data/config.py &&\ + sed -i 's,DEBUG\s\+=\s\+TRUE,DEBUG = False,gi' /data/config.py &&\ + sed -i 's,TESTING\s\+=\s\+TRUE,TESTING = False,gi' /data/config.py &&\ + ln -sf /data/config.py config.py &&\ +\ + apk add --no-cache --virtual .builddeps \ + alpine-sdk \ + cyrus-sasl-dev \ + openldap-dev \ + postgresql-dev \ + py-pip \ + python-dev \ + &&\ +\ + pip install -I \ + blinker==1.4 \ + flask==0.10.1 \ + flask-assets==0.10 \ + flask-babel==0.9 \ + flask-gravatar==0.4.1 \ + flask-login==0.2.11 \ + flask-mail==0.9.0 \ + flask-markdown==0.3 \ + flask-migrate==1.4.0 \ + flask-sqlalchemy==2.1 \ + &&\ + pip install -r requirements.txt &&\ + make i18n-compile &&\ +\ + apk del .builddeps &&\ + rm -rf /var/tmp/* /tmp/* + +VOLUME /data +CMD [ "python2", "manage.py", "runserver", "--host=0.0.0.0" ] +EXPOSE 5000 \ No newline at end of file diff --git a/patches/40d3da81ec2362b99bad6064d0064897c2a8cef1.patch b/patches/40d3da81ec2362b99bad6064d0064897c2a8cef1.patch new file mode 100644 index 0000000..42d3eeb --- /dev/null +++ b/patches/40d3da81ec2362b99bad6064d0064897c2a8cef1.patch @@ -0,0 +1,22 @@ +From 40d3da81ec2362b99bad6064d0064897c2a8cef1 Mon Sep 17 00:00:00 2001 +From: Carl Kittelberger +Date: Sun, 14 Aug 2016 00:08:29 +0200 +Subject: [PATCH] Fix auto-watch bug due to missing "mac" argument + +--- + dudel/views.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dudel/views.py b/dudel/views.py +index 5ca4d80..ad6a5d1 100644 +--- a/dudel/views.py ++++ b/dudel/views.py +@@ -800,7 +800,7 @@ def poll_vote(slug): + db.session.commit() + + if current_user.is_authenticated() and current_user.autowatch: +- return redirect(url_for("poll_watch", slug=poll.slug, watch="yes", next=poll.get_url())) ++ return redirect(url_for("poll_watch", slug=poll.slug, watch="yes", mac=poll.get_mac(), next=poll.get_url())) + else: + return redirect(poll.get_url()) +