You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
760 B
Docker

FROM python:3.8
# 安装netcat
RUN apt-get update
# 可选:设置镜像源为国内
COPY pip.conf /root/.pip/pip.conf
# 容器内创建 myproject 文件夹
ENV APP_HOME=/home/myproject
RUN mkdir -p $APP_HOME
WORKDIR $APP_HOME
# 将当前目录加入到工作目录中(. 表示当前目录)
ADD . $APP_HOME
# 更新pip版本
RUN /usr/local/bin/python -m pip install --upgrade pip
# 安装vim
RUN apt-get install -y vim
# 安装netcat
RUN apt-get install -y netcat
# 安装项目依赖
RUN pip install -r requirements.txt
# 移除\r in windows
RUN sed -i 's/\r//' ./start.sh
# 给start.sh可执行权限
RUN chmod +x ./start.sh
RUN chmod 777 -R /home/myproject/logs/
EXPOSE 8000
# 数据迁移,并启动服务
ENTRYPOINT /bin/bash ./start.sh