forked from radiateboy/automagic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
27 lines (20 loc) · 1.14 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
FROM python:3.7-alpine3.10
LABEL version="1.0" by="taoyanli0808" description="请先配置数据库,然后执行docker build -f Dockerfile .构建镜像。"
WORKDIR /automagic
COPY . /automagic
RUN echo "http://mirrors.aliyun.com/alpine/v3.10/main/" > /etc/apk/repositories \
&& apk update --no-cache \
&& apk upgrade --no-cache \
&& apk add --no-cache build-base mariadb-dev libffi-dev \
&& sed -i '342a\unsigned int reconnect;' /usr/include/mysql/mysql.h \
&& pip --no-cache-dir install -r /automagic/requirements/base.txt \
-i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com \
&& pip --no-cache-dir install -r /automagic/requirements/seleniumreq.txt \
-i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
RUN python init_database.py \
&& python manage.py makemigrations \
&& python manage.py migrate \
&& echo "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', '[email protected]', '52.clover')" | python manage.py shell
# 暴露出服务端口和MySQL端口
EXPOSE 3306 8000
CMD python manage.py runserver 0.0.0.0:8000