funkwhale/api/Dockerfile

85 wiersze
2.2 KiB
Docker
Czysty Zwykły widok Historia

FROM alpine:3.14 as builder
RUN \
echo 'installing dependencies' && \
apk add --no-cache \
git \
musl-dev \
gcc \
postgresql-dev \
python3-dev \
py3-psycopg2 \
py3-cryptography \
2022-03-01 14:04:15 +00:00
py3-pip \
libldap \
libffi-dev \
make \
zlib-dev \
jpeg-dev \
2020-02-04 10:43:08 +00:00
openldap-dev \
openssl-dev \
cargo \
2021-06-30 15:41:12 +00:00
libxml2-dev \
libxslt-dev \
curl \
2020-02-02 08:43:54 +00:00
&& \
ln -s /usr/bin/python3 /usr/bin/python && \
pip3 install --user poetry
# create virtual env for next stage
RUN python -m venv --system-site-packages /venv
# emulate activation by prefixing PATH
ENV PATH="/venv/bin:/root/.local/bin:$PATH" VIRTUAL_ENV=/venv
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/
RUN \
echo 'installing pip requirements' && \
pip3 install --upgrade pip && \
2019-01-24 10:04:29 +00:00
pip3 install setuptools wheel && \
2022-01-12 13:06:15 +00:00
# Currently we are unable to relieably build cryptography on armv7. This
# is why we need to use the package shipped by Alpine Linux, which is currently
# version 3.3.2. Since poetry does not allow in-place dependency pinning, we need
# to install the deps using pip.
2022-01-30 12:06:11 +00:00
poetry export --without-hashes | grep -Ev 'cryptography|autobahn' | pip3 install -r /dev/stdin cryptography==3.3.2 autobahn==21.2.1 && \
2019-01-24 10:04:29 +00:00
rm -rf $PIP_DOWNLOAD_CACHE
ARG install_dev_deps=0
RUN \
if [ "$install_dev_deps" = "1" ] ; then \
echo "Installing dev dependencies" && \
2022-01-30 12:06:11 +00:00
poetry export --dev --without-hashes | grep -Ev 'cryptography|autobahn' | pip3 install -r /dev/stdin cryptography==3.3.2 autobahn==21.2.1 \
; else \
echo "Skipping dev deps installation" \
; fi
FROM alpine:3.14 as build-image
COPY --from=builder /venv /venv
# emulate activation by prefixing PATH
ENV PATH="/venv/bin:$PATH"
RUN apk add --no-cache \
libmagic \
bash \
gettext \
python3 \
jpeg-dev \
ffmpeg \
libpq \
2021-06-30 15:41:12 +00:00
libxml2 \
libxslt \
py3-cryptography \
&& \
ln -s /usr/bin/python3 /usr/bin/python
COPY . /app
WORKDIR /app
RUN find . -type d -exec chmod 755 {} \+
ENTRYPOINT ["./compose/django/entrypoint.sh"]
CMD ["./compose/django/server.sh"]