目录结构
|——conf
|——mime.types
|——nginx.conf
|——requirements.txt
|——supervisord.conf
|——Dockerfile
|——get-pip.py
|——pip.conf
|——sources.list
Dockerfile
FROM ubuntu:20.04
ADD sources.list /etc/apt/sources.list
RUN apt-get update \
&& apt-get install -y vim supervisor python3.8 python3-distutils
ADD pip.conf /root/.pip/pip.conf
RUN mkdir -p /data/package /data/apps /data/conf /data/tmp /data/logs
WORKDIR /data/package
ADD get-pip.py ./
RUN python3.8 get-pip.py
WORKDIR /data
COPY ./conf/ /data/conf/
RUN ln -s /data/conf/supervisord.conf /etc/supervisor/conf.d/ \
&& supervisord -c /etc/supervisor/conf.d/supervisord.conf
RUN pip3 install -r /data/conf/requirements.txt
EXPOSE 8000 8001 8002
ENV ANGEL_ENV=pro
CMD ["/usr/bin/supervisord", "-n"]
打包镜像
docker build -t angel:20.04.p3.8 --rm=true .
运行镜像
docker run -dit --name angel20.04 angel:20.04.p3.8
进入容器
docker exec -it angel20.04 bash