forked from OSQA/osqa
-
Notifications
You must be signed in to change notification settings - Fork 625
/
Dockerfile
65 lines (55 loc) · 2.57 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# WARNING: this Docker file is not tested with the current askbot-setup script.
# most likely at least this file will need to be adapted to make it work.
# if you can help - please make explain what you want to do in the issues
# section of the repository and once your contribution is accepted - make a pull request.
#
#----------------------------------------------------
# This Dockerifle builds a simple Askbot installation
#
# It makes use of environment variables:
# 1. DATABASE_URL See https://github.com/kennethreitz/dj-database-url for details
# 2. SECRET_KEY for making hashes within Django.
# 3. ADMIN_PASSWORD used for creating a user named "admin"
# 4. NO_CRON set this to "yes" to disable the embedded cron job.
#
# Make sure to *+always* start the container with the same SECRET_KEY.
#
# Start with something like
#
# docker run -e 'DATABASE_URL=sqlite:////askbot-site/askbot.db' -e "SECRET_KEY=$(openssl rand 14 | base64)" -e ADMIN_PASSWORD=admin -p 8080:80 askbot/askbot:latest
#
# User uploads are stored in **/askbot_site/askbot/upfiles** . I'd recommend to make it a kubernetes volume.
FROM tiangolo/uwsgi-nginx:python3.6-alpine3.9
ARG SITE=askbot-site
ARG ASKBOT=.
ENV PYTHONUNBUFFERED 1
ENV ASKBOT_SITE /${SITE}
ENV UWSGI_INI /${SITE}/askbot_app/uwsgi.ini
# Not recognized by uwsgi-nginx, yet.
# The file doesn't exist either!
#ENV PRE_START_PATH /${SITE}/prestart.sh
# TODO: changing this requires another cache backend
ENV NGINX_WORKER_PROCESSES 1
ENV UWSGI_PROCESSES 1
ENV UWSGI_CHEAPER 0
ADD askbot_requirements.txt /
#RUN apt-get update && apt-get -y install cron git \
RUN apk add --update --no-cache git py3-cffi \
gcc g++ git make unzip mkinitfs kmod mtools squashfs-tools py3-cffi \
libffi-dev linux-headers musl-dev libc-dev openssl-dev \
python3-dev zlib-dev libxml2-dev libxslt-dev jpeg-dev \
postgresql-dev zlib jpeg libxml2 libxslt postgresql-libs \
&& python -m pip install --upgrade pip \
&& pip install -r /askbot_requirements.txt \
&& pip install psycopg2
ADD $ASKBOT /src
RUN cd /src/ && python setup.py install \
&& askbot-setup -n /${SITE} -e 1 -d postgres -u postgres -p askbotPW --db-host=postgres --db-port=5432 --logfile-name=stdout --no-secret-key --create-project container-uwsgi
RUN true \
&& cp /${SITE}/askbot_app/prestart.sh /app \
&& /usr/bin/crontab /${SITE}/askbot_app/crontab \
&& cd /${SITE} && SECRET_KEY=whatever DJANGO_SETTINGS_MODULE=askbot_app.settings python manage.py collectstatic --noinput
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.5.0/wait /wait
RUN chmod +x /wait
WORKDIR /${SITE}