FROM python:3.9-alpine AS base LABEL MAINTAINER="heckyel@riseup.net" FROM base AS builder ENV LANG C.UTF-8 ENV LC_ALL C.UTF-8 RUN apk add --no-cache musl-dev build-base make gcc g++ libffi-dev ARG APP_DIR="/srv/app" RUN mkdir --parents "$APP_DIR" WORKDIR "$APP_DIR" COPY database /srv/app/database COPY routes /srv/app/routes COPY utils /srv/app/utils COPY config.py /srv/app COPY main.py /srv/app COPY wsgi.py /srv/app COPY requirements.txt /srv/app RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir --prefix=/install wheel gunicorn RUN pip install --no-cache-dir --prefix=/install -r requirements.txt FROM base WORKDIR /srv/app COPY --from=builder /install /usr/local COPY --from=builder /srv/app /srv/app EXPOSE 5000 COPY entrypoint.sh / RUN chmod u+x /entrypoint.sh ENTRYPOINT ["/entrypoint.sh"]