parent
ecfca080f0
commit
4ac6dd8f26
@ -0,0 +1,81 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
env/
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*,cover
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
|
||||
# PyCharm
|
||||
# http://www.jetbrains.com/pycharm/webhelp/project.html
|
||||
.idea
|
||||
.iml
|
||||
|
||||
# virtualenv
|
||||
venv/
|
||||
|
||||
migrations/
|
||||
!migrations/__init__.py
|
||||
collectedstatic/
|
||||
DjangoBlog/whoosh_index/
|
||||
google93fd32dbd906620a.html
|
||||
baidu_verify_FlHL7cUyC9.html
|
||||
BingSiteAuth.xml
|
||||
cb9339dbe2ff86a5aa169d28dba5f615.txt
|
||||
werobot_session
|
||||
django.jpg
|
||||
uploads/
|
||||
settings_production.py
|
||||
werobot_session.db
|
||||
@ -0,0 +1,65 @@
|
||||
FROM alpine:3.11
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./requirements.txt .
|
||||
|
||||
RUN apk --update --no-cache add python3 py3-pip py-gunicorn nginx mariadb-connector-c \
|
||||
&& apk --update --no-cache add --virtual .build-deps \
|
||||
tzdata \
|
||||
# mysqlclient dependencies
|
||||
python3-dev \
|
||||
mariadb-connector-c-dev \
|
||||
gcc \
|
||||
musl-dev \
|
||||
# Pillow dependencies
|
||||
jpeg-dev \
|
||||
zlib-dev \
|
||||
freetype-dev \
|
||||
lcms2-dev \
|
||||
openjpeg-dev \
|
||||
tiff-dev \
|
||||
tk-dev \
|
||||
tcl-dev \
|
||||
harfbuzz-dev \
|
||||
fribidi-dev \
|
||||
&& pip3 install --upgrade pip setuptools gevent \
|
||||
&& mkdir -p /run/nginx \
|
||||
&& pip3 install -r requirements.txt \
|
||||
&& cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime \
|
||||
&& echo "Asia/Shanghai" > /etc/timezone \
|
||||
&& apk del .build-deps
|
||||
|
||||
COPY . .
|
||||
RUN python3 manage.py collectstatic --noinput \
|
||||
&& python3 manage.py compress --force
|
||||
|
||||
COPY ./docker-support/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
ENV DJANGO_DEBUG False
|
||||
ENV DJANGO_SECRET_KEY DJANGO_BLOG_CHANGE_ME
|
||||
|
||||
ENV DJANGO_MYSQL_DATABASE djangoblog
|
||||
ENV DJANGO_MYSQL_USER root
|
||||
ENV DJANGO_MYSQL_PASSWORD djangoblog_123
|
||||
ENV DJANGO_MYSQL_HOST 127.0.0.1
|
||||
ENV DJANGO_MYSQL_PORT 3306
|
||||
|
||||
ENV DJANGO_MEMCACHED_ENABLE True
|
||||
ENV DJANGO_MEMCACHED_LOCATION 127.0.0.1:11211
|
||||
|
||||
ENV DJANGO_BAIDU_NOTIFY_URL http://data.zz.baidu.com/urls?site=https://www.example.org&token=CHANGE_ME
|
||||
|
||||
ENV DJANGO_EMAIL_TLS False
|
||||
ENV DJANGO_EMAIL_SSL True
|
||||
ENV DJANGO_EMAIL_HOST smtp.example.org
|
||||
ENV DJANGO_EMAIL_PORT 465
|
||||
ENV DJANGO_EMAIL_USER SMTP_USER_CHANGE_ME
|
||||
ENV DJANGO_EMAIL_PASSWORD SMTP_PASSWORD_CHANGE_ME
|
||||
|
||||
ENV DJANGO_ADMIN_EMAIL admin@example.org
|
||||
|
||||
ENV DJANGO_WXADMIN_PASSWORD DJANGO_BLOG_CHANGE_ME
|
||||
ENV DJANGO_WEROBOT_TOKEN DJANGO_BLOG_CHANGE_ME
|
||||
|
||||
EXPOSE 80
|
||||
ENTRYPOINT ["./docker-support/entrypoint.sh"]
|
||||
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
cd /app
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
nginx
|
||||
gunicorn DjangoBlog.wsgi:application \
|
||||
--name djangoblog \
|
||||
--user root \
|
||||
--group root \
|
||||
--bind 127.0.0.1:8000 \
|
||||
--log-level=debug \
|
||||
--log-file=- \
|
||||
--workers $(grep -c ^processor /proc/cpuinfo) \
|
||||
--worker-class gevent
|
||||
else
|
||||
python3 ./manage.py $1
|
||||
fi
|
||||
@ -0,0 +1,22 @@
|
||||
server {
|
||||
root /app/;
|
||||
listen 80;
|
||||
keepalive_timeout 70;
|
||||
|
||||
location /static/ {
|
||||
expires max;
|
||||
alias /app/collectedstatic/;
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
proxy_redirect off;
|
||||
if (!-f $request_filename) {
|
||||
proxy_pass http://127.0.0.1:8000;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue