forked from gxtrobot/bustag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
55 lines (31 loc) · 1.15 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
FROM python:3.7.4-slim as base
# Create app directory
WORKDIR /app
# Install app dependencies
COPY ./docker/sources.list .
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && mv ./sources.list /etc/apt/
RUN apt-get -o Acquire::Check-Valid-Until=false update \
&& apt-get install \
--no-install-recommends --yes \
build-essential libpq-dev cron git \
python3-dev --yes
FROM base as build
COPY requirements.txt .
RUN mkdir /install
RUN pip download --destination-directory /install -r /app/requirements.txt -i https://pypi.douban.com/simple
FROM python:3.7.4-slim as release
COPY ./docker/sources.list .
RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak && mv ./sources.list /etc/apt/
RUN apt-get update && apt-get -y install cron git
WORKDIR /app
COPY --from=build /install /install
COPY requirements.txt .
RUN pip install --no-index --find-links=/install -r requirements.txt
RUN mkdir /app/docker
COPY docker/entry.sh /app/docker/
RUN touch /var/log/bustag.log
RUN rm -rf /install && rm -rf /root/.cache/pip
RUN chmod 755 /app/docker/*.sh
EXPOSE 8000
LABEL maintainer="gxtrobot <[email protected]>"
CMD ["/app/docker/entry.sh"]