ARG PYTHON_ALPINE
FROM ${PYTHON_ALPINE}

WORKDIR /app
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1
ENV LOGPATH=/var/log/sf-notifier/sfnotifier.log

COPY requirements.txt ./
RUN addgroup --gid 1000 \
      sfnotifier && \
    adduser --ingroup sfnotifier \
      --uid 1000 \
      --disabled-password \
      --home /app \
      sfnotifier && \
    mkdir -p `dirname $LOGPATH` && \
    touch $LOGPATH && \
    chown -R 1000:1000 `dirname $LOGPATH` && \
    apk upgrade --update --no-cache && \
    apk add --no-cache \
      build-base \
      openssl-dev \
      curl \
      libffi-dev && \
    pip install --upgrade pip && \
    pip install --upgrade setuptools wheel && \
    pip install -r /app/requirements.txt && \
    apk del build-base

COPY . .
CMD ./entrypoint.sh

ARG UCP_VERSION
LABEL com.docker.ucp.version="$UCP_VERSION"

EXPOSE 12390
