FROM alpine:3.11
LABEL maintainer="<NAME> <<EMAIL>>" \
      vent="" \
      vent.name="file_drop" \
      vent.groups="core,files" \
      vent.repo="https://github.com/cyberreboot/vent" \
      vent.type="repository"

RUN apk add --update \
    curl \
    python3 \
    py3-pip \
    && rm -rf /var/cache/apk/*

RUN pip3 install --no-cache-dir --upgrade pip==19.1

# healthcheck
COPY healthcheck /healthcheck
RUN pip3 install --no-cache-dir -r /healthcheck/requirements.txt
ENV FLASK_APP /healthcheck/hc.py
HEALTHCHECK --interval=15s --timeout=15s \
 CMD curl --silent --fail http://localhost:5000/healthcheck || exit 1

COPY . /file-drop
RUN pip3 install --no-cache-dir -r /file-drop/requirements.txt

WORKDIR /file-drop

CMD (flask run > /dev/null 2>&1) & (python3 /file-drop/file_drop.py)
