|
|
@ -1,29 +1,43 @@
|
|
|
|
FROM python:3.8-slim
|
|
|
|
# pip dependencies install stage
|
|
|
|
|
|
|
|
FROM python:3.8-slim as builder
|
|
|
|
|
|
|
|
|
|
|
|
# rustc compiler would be needed on ARM type devices but theres an issue with some deps not building..
|
|
|
|
# rustc compiler would be needed on ARM type devices but theres an issue with some deps not building..
|
|
|
|
ARG CRYPTOGRAPHY_DONT_BUILD_RUST=1
|
|
|
|
ARG CRYPTOGRAPHY_DONT_BUILD_RUST=1
|
|
|
|
|
|
|
|
|
|
|
|
COPY requirements.txt /tmp/requirements.txt
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
|
|
|
|
libssl-dev \
|
|
|
|
|
|
|
|
libffi-dev \
|
|
|
|
|
|
|
|
gcc \
|
|
|
|
|
|
|
|
libc-dev \
|
|
|
|
|
|
|
|
libxslt-dev \
|
|
|
|
|
|
|
|
zlib1g-dev \
|
|
|
|
|
|
|
|
rustc \
|
|
|
|
|
|
|
|
g++
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN mkdir /install
|
|
|
|
|
|
|
|
WORKDIR /install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
COPY requirements.txt /requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RUN pip install --target=/dependencies -r /requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
RUN apt-get update && apt-get install -y libssl-dev libffi-dev gcc libc-dev libxslt-dev zlib1g-dev rustc g++ --no-install-recommends && rm -rf /var/lib/apt/lists/* /var/cache/apt/*
|
|
|
|
# Final image stage
|
|
|
|
# Update pip, install requirements, remove rust and dev packages that are no longer needed.
|
|
|
|
FROM python:3.8-slim
|
|
|
|
RUN pip3 install --upgrade pip && pip3 install --no-cache-dir -r /tmp/requirements.txt && apt-get remove rustc *-dev --purge -y
|
|
|
|
|
|
|
|
|
|
|
|
# https://stackoverflow.com/questions/58701233/docker-logs-erroneously-appears-empty-until-container-stops
|
|
|
|
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
|
|
|
|
RUN [ ! -d "/app" ] && mkdir /app
|
|
|
|
|
|
|
|
RUN [ ! -d "/datastore" ] && mkdir /datastore
|
|
|
|
RUN [ ! -d "/datastore" ] && mkdir /datastore
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Copy modules over to the final image and add their dir to PYTHONPATH
|
|
|
|
|
|
|
|
COPY --from=builder /dependencies /usr/local
|
|
|
|
|
|
|
|
ENV PYTHONPATH=/usr/local
|
|
|
|
|
|
|
|
|
|
|
|
# The actual flask app
|
|
|
|
# The actual flask app
|
|
|
|
COPY backend /app/backend
|
|
|
|
COPY backend /app/backend
|
|
|
|
|
|
|
|
|
|
|
|
# The eventlet server wrapper
|
|
|
|
# The eventlet server wrapper
|
|
|
|
COPY changedetection.py /app/changedetection.py
|
|
|
|
COPY changedetection.py /app/changedetection.py
|
|
|
|
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
# https://stackoverflow.com/questions/58701233/docker-logs-erroneously-appears-empty-until-container-stops
|
|
|
|
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CMD [ "python", "./changedetection.py" , "-d", "/datastore"]
|
|
|
|
CMD [ "python", "./changedetection.py" , "-d", "/datastore"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|