dapi Django-based lightweight test platform for deployment of eight Docker

QQ group: 529 063 263

GitHub:https://github.com/yjlch1016/dapi

 

采用Docker+Supervisor+Nginx+uWSGI+Django

A, Dockerfile file:

Ubuntu the FROM: 18.04
# base image

MAINTAINER yangjianliang <[email protected]>
# Author

RUN sed -is@/archive.ubuntu.com / @ / mirrors.aliyun.com/@g /etc/apt/sources.list
# Set Ali cloud apt source for the source

RUN apt-GET Clean && \
    apt-GET Update && \
    apt GET upgrade -y-
# checking the package and upgrade

RUN-apt GET install -y \
    git \
    python3 && \
    apt-GET Update && \
    GET install -y-APT \
    python3-dev \
    python3-setuptools && \
    APT-GET Update && \
    APT-GET install -y \
    python3-PIP && \
    APT-GET && Update\
    apt-get install -y \
    nginx \
    supervisor &&\
    Update && GET-APT \
    LN -fs / usr / Share / zoneinfo / Asia / of Shanghai / etc / localtime && \
    APT-GET the install -Y \
    tzdata && \
    RM -rf / var / lib / APT / Lists / *
# install software

RUN echo "daemon OFF;" >> /etc/nginx/nginx.conf
COPY deploy_conf / nginx-app.conf / etc / nginx / sites-the Available / default
COPY deploy_conf / Supervisor-app.conf / etc / Supervisor / conf .d /
cOPY deploy_conf / pip.conf /root/.pip/pip.conf
# copy profile

RUN PIP3 install https://codeload.github.com/sshwsfc/xadmin/zip/django2
cOPY requirements.txt / Django / DAPI /
RUN PIP3 install -r /django/dapi/requirements.txt
# install Python dependencies

COPY. / django / dapi /
Sed -i '35 RUN, 36d '/usr/local/lib/python3.6/dist-packages/django/db/backends/mysql/base.py && \
sed -i' 145,146d '/ usr / local / lib && /python3.6/dist-packages/django/db/backends/mysql/operations.py \
sed -i '93d' /usr/local/lib/python3.6/dist-packages/django/forms/boundfield.py
# copy the rest of the code and modify the source Django

eXPOSE 80
# 80 exposed port

CMD [ "supervisord", "-c", "/etc/supervisor/conf.d/supervisor-app.conf"]
# start supervisor and load configuration file

 

Second, the packaging:

docker build -t dapi .

Wait a while

Suman, then ten minutes of it

 

Third, run:

docker run -d --name dapi1.0 -p 80:80 dapi:latest

# Start the container and run in the background, exposure to port 80, and taking individual named dapi1.0

 

docker inspect dapi1.0

# View container IP address

 

docker exec -it dapi1.0 /bin/bash

# Into the interior of the container

supervisord -c /etc/supervisor/conf.d/supervisor-app.conf

# Manually start supervisor

 

Access (host IP address):

http://192.168.1.102/

账号:admin

密码:test123456

 

后台:

http://192.168.1.102/admin/

账号:admin

密码:test123456

 

 

Guess you like

Origin www.cnblogs.com/yjlch1016/p/12355446.html