-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
61 lines (49 loc) · 1.99 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
56
57
58
59
60
61
##
# `base` contains the only the core system-level dependencies needed to run
# the diff server. `dev` builds on it by adding compile-time support for the
# same packages so that we can build the Python dependencies that have C code,
# like `lxml`.
# We separate them out so that the final `release` image can layer on top of
# this one without needing compiler-related packages.
##
FROM python:3.10.11-slim as base
LABEL maintainer="enviroDGI@gmail.com"
RUN apt-get update && apt-get install -y --no-install-recommends \
libxml2 libxslt1.1 libz1 openssl libcurl4
##
# `dev` is an intermediate image that is used for building compiled
# dependencies or can be used as a development environment if you want to work
# in a Docker container.
##
FROM base as dev
RUN apt-get update && apt-get install -y --no-install-recommends \
git gcc g++ pkg-config \
# Compiler-support for the system dependencies in `base`
libxml2-dev libxslt-dev libz-dev libssl-dev libcurl4-openssl-dev
# Set the working directory to /app
WORKDIR /app
RUN pip install --upgrade pip
# Copy the requirements.txt alone into the container at /app
# so that they can be cached more aggressively than the rest of the source.
ADD requirements.txt /app
RUN pip install --trusted-host pypi.python.org -r requirements.txt
ADD requirements-server.txt /app
RUN pip install --trusted-host pypi.python.org -r requirements-server.txt
ADD requirements-experimental.txt /app
RUN pip install --trusted-host pypi.python.org -r requirements-experimental.txt
# Copy the rest of the source.
ADD . /app
# ...and install!
RUN pip install .[server] --no-binary lxml
##
# `release` is the final, release-ready image with only the necessary
# dependencies to run all diffs and the diff server.
##
FROM base as release
# Copy built python dependencies.
COPY --from=dev /usr/local/lib/ /usr/local/lib/
# Copy executables.
COPY --from=dev /usr/local/bin /usr/local/bin
ENV LD_LIBRARY_PATH=/usr/local/lib
EXPOSE 80
CMD ["web-monitoring-diff-server", "--port", "80"]