platypush/platypush/install/docker/alpine.Dockerfile
Fabio Manganiello 8e05a7f4c9
Make Dockerfiles work both within and outside a Platypush source dir.
If the Platypush setup.py is found in the current directory, then use
that directory as the base for the new image.

Otherwise, clone the repo on the fly and build the image from there.
2024-05-25 00:42:30 +02:00

35 lines
963 B
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 'name="platypush"' /curdir/setup.py >/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 . --break-system-packages && \
rm -rf /install && \
apk cache clean
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