-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
39 lines (30 loc) · 1.17 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
FROM python:3.9.16-slim
RUN sed -i "s@http://deb.debian.org@http://mirrors.aliyun.com@g" /etc/apt/sources.list &&\
rm -Rf /var/lib/apt/lists/* &&\
apt-get update
RUN pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U \
&& pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
RUN apt-get update && \
apt-get install -y gcc git libpq-dev libmagic1 default-libmysqlclient-dev &&\
apt clean && \
rm -rf /var/cache/apt/*
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONIOENCODING utf-8
# 时区设置
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo 'Asia/Shanghai' > /etc/timezone
COPY requirement.txt /tmp/requirement.txt
#================================================
# Packages
#================================================
RUN pip install --upgrade pip && pip install wheel &&\
pip install --no-cache-dir -r /tmp/requirement.txt
#================================================
# Code
#================================================
COPY . /code
RUN mkdir -p /code/logs
RUN rm -Rf /code/.git
WORKDIR /code/src/launcher
CMD ["python3", "run_spiders.py", ">nohup.spiders", "2>&1"]