taken from https://github.com/healthchecks/healthchecks/issues/568#issuecomment-942047344
36 lines
1.2 KiB
Docker
36 lines
1.2 KiB
Docker
FROM python:3.10-alpine3.15
|
|
|
|
#Install all dependencies.
|
|
RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev py-cryptography openldap
|
|
|
|
#Print all logs without buffering it.
|
|
ENV PYTHONUNBUFFERED 1
|
|
|
|
#This port will be used by gunicorn.
|
|
EXPOSE 8080
|
|
|
|
#Create app dir and install requirements.
|
|
RUN mkdir /opt/recipes
|
|
WORKDIR /opt/recipes
|
|
|
|
COPY requirements.txt ./
|
|
|
|
RUN \
|
|
if [ `dpkg --print-architecture` = "armhf" ]; then \
|
|
printf "[global]\nextra-index-url=https://www.piwheels.org/simple\n" > /etc/pip.conf ; \
|
|
fi
|
|
|
|
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev libressl-dev libffi-dev cargo openssl-dev openldap-dev python3-dev && \
|
|
echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \
|
|
python -m venv venv && \
|
|
/opt/recipes/venv/bin/python -m pip install --upgrade pip && \
|
|
venv/bin/pip install wheel==0.37.1 && \
|
|
venv/bin/pip install setuptools_rust==1.1.2 && \
|
|
venv/bin/pip install -r requirements.txt --no-cache-dir &&\
|
|
apk --purge del .build-deps
|
|
|
|
#Copy project and execute it.
|
|
COPY . ./
|
|
RUN chmod +x boot.sh
|
|
ENTRYPOINT ["/opt/recipes/boot.sh"]
|