Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化 Dockerfile #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
FROM centos:7
FROM python:3.6-slim-buster
# 设置编码
ENV LANG en_US.UTF-8
# 同步时间
ENV TZ=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# 1. 安装基本依赖
RUN yum update -y && yum install epel-release -y && yum update -y && yum install wget unzip epel-release nginx xz gcc automake zlib-devel openssl-devel supervisor groupinstall development libxslt-devel libxml2-devel libcurl-devel git -y
#WORKDIR /var/www/
# 1. 安装基础环境
RUN apt update &&\
apt install -y --no-install-recommends \
supervisor \
nginx \
git \
&& rm -rf /var/lib/apt/lists/*

# 2. 准备python
RUN wget https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz
RUN xz -d Python-3.6.6.tar.xz && tar xvf Python-3.6.6.tar && cd Python-3.6.6 && ./configure && make && make install
# 2. 安装 python 依赖
RUN pip3 install --no-cache-dir -U git+https://github.com/ss1917/ops_sdk.git
COPY doc/requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt

# 3. 安装websdk
RUN pip3 install --upgrade pip
RUN pip3 install -U git+https://github.com/ss1917/ops_sdk.git

# 4. 复制代码
# 3. 复制代码
RUN mkdir -p /var/www/
ADD . /var/www/codo-tools/

# 5. 安装pip依赖
RUN pip3 install -r /var/www/codo-tools/doc/requirements.txt

# 6. 日志
# 4. 日志
VOLUME /var/log/

# 7. 准备文件
# 5. 准备文件
COPY doc/nginx_ops.conf /etc/nginx/conf.d/default.conf
COPY doc/supervisor_ops.conf /etc/supervisord.conf

EXPOSE 80
CMD ["/usr/bin/supervisord"]
CMD ["/usr/bin/supervisord"]