2021-05-28 09:39:27 +00:00
|
|
|
FROM alpine:3.13 as builder
|
2017-06-23 21:00:42 +00:00
|
|
|
|
2019-01-21 12:54:46 +00:00
|
|
|
RUN \
|
|
|
|
echo 'installing dependencies' && \
|
2021-09-12 11:33:52 +00:00
|
|
|
apk add --no-cache \
|
|
|
|
git \
|
|
|
|
musl-dev \
|
2019-01-21 12:54:46 +00:00
|
|
|
gcc \
|
|
|
|
postgresql-dev \
|
2021-09-12 11:33:52 +00:00
|
|
|
python3-dev \
|
|
|
|
py3-psycopg2 \
|
2021-12-13 19:31:13 +00:00
|
|
|
py3-cryptography \
|
2021-09-12 11:33:52 +00:00
|
|
|
libldap \
|
|
|
|
libffi-dev \
|
|
|
|
make \
|
|
|
|
zlib-dev \
|
|
|
|
jpeg-dev \
|
2020-02-04 10:43:08 +00:00
|
|
|
openldap-dev \
|
2021-05-28 09:39:27 +00:00
|
|
|
openssl-dev \
|
|
|
|
cargo \
|
2021-06-30 15:41:12 +00:00
|
|
|
libxml2-dev \
|
|
|
|
libxslt-dev \
|
2020-02-02 08:43:54 +00:00
|
|
|
&& \
|
2019-01-21 12:54:46 +00:00
|
|
|
ln -s /usr/bin/python3 /usr/bin/python
|
2019-01-11 12:50:42 +00:00
|
|
|
|
2020-03-09 16:04:06 +00:00
|
|
|
# create virtual env for next stage
|
2021-12-13 19:31:13 +00:00
|
|
|
RUN python -m venv --system-site-packages /venv
|
2020-03-09 16:04:06 +00:00
|
|
|
# emulate activation by prefixing PATH
|
|
|
|
ENV PATH="/venv/bin:$PATH" VIRTUAL_ENV=/venv
|
|
|
|
|
2022-01-10 14:48:38 +00:00
|
|
|
COPY pyproject.toml poetry.lock /
|
2019-01-24 10:04:29 +00:00
|
|
|
# hack around https://github.com/pypa/pip/issues/6158#issuecomment-456619072
|
|
|
|
ENV PIP_DOWNLOAD_CACHE=/noop/
|
2019-01-21 12:54:46 +00:00
|
|
|
RUN \
|
|
|
|
echo 'installing pip requirements' && \
|
2022-01-10 14:48:38 +00:00
|
|
|
pip3 install --upgrade pip poetry && \
|
2019-01-24 10:04:29 +00:00
|
|
|
pip3 install setuptools wheel && \
|
2022-01-10 14:48:38 +00:00
|
|
|
poetry export --without-hashes | grep -v cryptography | pip3 install -r /dev/stdin cryptography==3.3.2 && \
|
2019-01-24 10:04:29 +00:00
|
|
|
rm -rf $PIP_DOWNLOAD_CACHE
|
2017-06-23 21:00:42 +00:00
|
|
|
|
2019-01-21 12:54:46 +00:00
|
|
|
ARG install_dev_deps=0
|
|
|
|
RUN \
|
2022-01-10 14:48:38 +00:00
|
|
|
if [ "$install_dev_deps" = "1" ] ; then \
|
|
|
|
echo "Installing dev dependencies" && \
|
|
|
|
poetry export --dev --without-hashes | grep -v cryptography | pip3 install -r /dev/stdin cryptography==3.3.2 && \
|
|
|
|
; else \
|
|
|
|
echo "Skipping dev deps installation" \
|
|
|
|
; fi
|
2017-06-23 21:00:42 +00:00
|
|
|
|
2020-03-09 16:04:06 +00:00
|
|
|
|
2021-05-28 09:39:27 +00:00
|
|
|
FROM alpine:3.13 as build-image
|
2020-03-09 16:04:06 +00:00
|
|
|
|
|
|
|
COPY --from=builder /venv /venv
|
|
|
|
# emulate activation by prefixing PATH
|
|
|
|
ENV PATH="/venv/bin:$PATH"
|
|
|
|
|
|
|
|
RUN apk add --no-cache \
|
|
|
|
libmagic \
|
2021-09-12 11:33:52 +00:00
|
|
|
bash \
|
|
|
|
gettext \
|
|
|
|
python3 \
|
2020-03-09 16:04:06 +00:00
|
|
|
jpeg-dev \
|
2021-09-12 11:33:52 +00:00
|
|
|
ffmpeg \
|
|
|
|
libpq \
|
2021-06-30 15:41:12 +00:00
|
|
|
libxml2 \
|
|
|
|
libxslt \
|
2021-12-13 19:31:13 +00:00
|
|
|
py3-cryptography \
|
2020-03-09 16:04:06 +00:00
|
|
|
&& \
|
|
|
|
ln -s /usr/bin/python3 /usr/bin/python
|
|
|
|
|
2021-09-12 11:33:52 +00:00
|
|
|
COPY . /app
|
|
|
|
WORKDIR /app
|
|
|
|
|
2021-09-20 10:42:41 +00:00
|
|
|
RUN find . -type d -exec chmod 755 {} \+
|
2020-03-09 16:04:06 +00:00
|
|
|
|
2017-06-23 21:00:42 +00:00
|
|
|
ENTRYPOINT ["./compose/django/entrypoint.sh"]
|
2019-06-19 08:26:09 +00:00
|
|
|
CMD ["./compose/django/server.sh"]
|