history-project/meian/Dockerfile
2024-10-24 09:04:38 +08:00

33 lines
1.2 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 将官方 Python 运行时用作父镜像
FROM python:3.10.13-slim-bullseye
# 工作目录设置
RUN mkdir -p /app
WORKDIR /app/meian
# 将文件复制到容器中
COPY btop ./sources.list.bullseye ./requirements.txt ./*.py /app/meian/
COPY ./data /app/meian/data
COPY ./devices /app/meian/devices
RUN export TZ=Asia/Shanghai \
&& ln -sf /usr/share/zoneinfo/$TZ /etc/localtime \
&& echo $TZ > /etc/timezone \
&& export http_proxy=$proxy_url && export https_proxy=$proxy_url \
&& mv sources.list.bullseye /etc/apt/sources.list \
&& apt-get update \
&& apt-get install -y iputils-ping vim net-tools telnet sqlite3 curl \
&& pip install --no-cache-dir -r requirements.txt -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com --timeout 1000 \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& unset http_proxy \
&& unset https_proxy
RUN echo "alias ll='ls -alh --color'" >> /root/.bashrc
RUN echo "alias ll='ls -alh --color'" >> /root/.profile
# 0: 本地环境1测试容器环境2: 生产容器环境3: 本地开发环境
ENV ENV_TYPE=2
#CMD ["sleep", "3600"]
CMD ["python", "app.py"]