!12 增加Dockerfile文件和修复时间线bug

Merge pull request !12 from jonnyan404/master
This commit is contained in:
州的先生 2021-02-23 22:36:25 +08:00 committed by Gitee
commit 4ecb00327c
3 changed files with 43 additions and 1 deletions

20
Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM python:3.7-alpine
LABEL maintainer="www.mrdoc.fun"
ENV PYTHONUNBUFFERED=0 \
TZ=Asia/Shanghai \
LISTEN_PORT=10086\
USER=admin
COPY . /app/MrDoc/
WORKDIR /app/MrDoc
RUN set -x \
&& apk add --no-cache --virtual .build-deps build-base g++ gcc libxslt-dev python2-dev linux-headers \
&& apk add --no-cache pwgen git tzdata zlib-dev freetype-dev jpeg-dev mariadb-dev postgresql-dev \
&& pip --no-cache-dir install -r requirements.txt \
&& pip --no-cache-dir install mysqlclient \
&& chmod +x mrdoc.sh \
&& apk del .build-deps \
&& rm -rf /var/cache/apk/*
ENTRYPOINT ["./mrdoc.sh"]

22
mrdoc.sh Normal file
View File

@ -0,0 +1,22 @@
#!/bin/sh
python /app/MrDoc/manage.py makemigrations && python /app/MrDoc/manage.py migrate && echo y |python /app/MrDoc/manage.py rebuild_index
MM=`pwgen -1s`
CREATE_USER=1
if [ $CREATE_USER -eq 1 ]; then
if [ ! -e $CREATE_USER ]; then
touch $CREATE_USER
echo "-- First container startup --user:${USER} pwd:${MM}"
echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('${USER}', 'www@mrdoc.fun', '${MM}')" | python /app/MrDoc/manage.py shell
# YOUR_JUST_ONCE_LOGIC_HERE
else
echo "-- Not first container startup --"
fi
else
echo "user switch not create"
fi
python -u /app/MrDoc/manage.py runserver --noreload 0.0.0.0:${LISTEN_PORT}
exec "$@"

View File

@ -3979,7 +3979,7 @@
else if(/^timeline/i.test(lang)){ // 时间线
var time_line = '<ul class="layui-timeline">'
// console.log(code)
var timeline_code = code.split(/[(\r\n)\r\n]+/);
var timeline_code = code.split(/(\r\n\t|\n|\r\t)+/);
// console.log(timeline_code)
timeline_code.forEach(function(item,index){
// console.log(item,index)