platypush/platypush/install/docker/alpine.Dockerfile
Fabio Manganiello 9ebe251d46
Several Docker image improvements.
- Reduced size of the Ubuntu image by removing some unneeded packages
  (docutils, manpages, babel, fonts, python-pil etc.) that take a lot of
  space.

- Better self-documented docker-compose.yml.

- Added reference to the registry.platypush.tech/platypush image in
  docker-compose.yml (README reference will follow).

- Fixed grep condition in the Docker prepare script.

- Pass `--no-deps` to `pip install platypush`. The dependencies of the
  application, now that `marshmallow_dataclasses` has been removed, are
  all available in the package managers of the supported images (with
  the exception for croniter in Alpine Linux for now), so they can all
  be installed via system package manager rather than pip. This also
  prevents Ubuntu builds from breaking because system-installed packages
  are being overwritten with pip-installed copies.
2024-10-03 20:35:01 +02:00

40 lines
1.2 KiB
Docker

FROM alpine
ARG DOCKER_CTX=1
ENV DOCKER_CTX=1
WORKDIR /var/lib/platypush
RUN --mount=type=bind,source=.,target=/curdir \
apk update && \
# If the current directory is the Platypush repository, then we can copy the existing files \
if grep -E 'name\s*=\s*"platypush"' /curdir/pyproject.toml >/dev/null 2>&1; \
then \
cp -r /curdir /install; \
# Otherwise, we need to clone the repository \
else \
apk add --no-cache git && \
git clone https://github.com/blacklight/platypush.git /install; \
fi
RUN /install/platypush/install/scripts/alpine/install.sh && \
cd /install && \
pip install -U --no-input --no-cache-dir --no-deps . croniter --break-system-packages && \
rm -rf /install && \
rm -rf /root/.cache && \
apk del gcc git && \
apk cache clean && \
rm -rf /var/cache/apk/* && \
rm -rf /tmp/* && \
find / | grep -E "(/__pycache__$|\.pyc$|\.pyo$)" | xargs rm -rf
EXPOSE 8008
VOLUME /etc/platypush
VOLUME /var/lib/platypush
VOLUME /var/cache/platypush
CMD platypush \
--start-redis \
--config /etc/platypush/config.yaml \
--workdir /var/lib/platypush \
--cachedir /var/cache/platypush