diff --git a/docker-compose.yml b/docker-compose.yml index 0603a81aa1..cff19ee7b8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,5 @@ services: platypush: - container_name: platypush restart: "always" command: - platypush diff --git a/platypush/install/docker/alpine.Dockerfile b/platypush/install/docker/alpine.Dockerfile index e0a903d29d..47856d0046 100644 --- a/platypush/install/docker/alpine.Dockerfile +++ b/platypush/install/docker/alpine.Dockerfile @@ -1,14 +1,24 @@ FROM alpine -ADD . /install -WORKDIR /var/lib/platypush - ARG DOCKER_CTX=1 ENV DOCKER_CTX=1 +WORKDIR /var/lib/platypush -RUN apk update && \ - /install/platypush/install/scripts/alpine/install.sh && \ - cd /install && pip install -U --no-input --no-cache-dir . --break-system-packages && \ +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 diff --git a/platypush/install/docker/debian.Dockerfile b/platypush/install/docker/debian.Dockerfile index 2608e93825..d19248db05 100644 --- a/platypush/install/docker/debian.Dockerfile +++ b/platypush/install/docker/debian.Dockerfile @@ -1,6 +1,5 @@ FROM debian -ADD . /install WORKDIR /var/lib/platypush ARG DEBIAN_FRONTEND=noninteractive @@ -8,8 +7,19 @@ ENV DEBIAN_FRONTEND=noninteractive ARG DOCKER_CTX=1 ENV DOCKER_CTX=1 -RUN apt update && \ - /install/platypush/install/scripts/debian/install.sh && \ +RUN --mount=type=bind,source=.,target=/curdir \ + apt 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 \ + apt install -y git && \ + git clone https://github.com/blacklight/platypush.git /install; \ + fi + +RUN /install/platypush/install/scripts/debian/install.sh && \ cd /install && \ pip install -U --no-input --no-cache-dir . --break-system-packages && \ rm -rf /install && \ diff --git a/platypush/install/docker/fedora.Dockerfile b/platypush/install/docker/fedora.Dockerfile index 3b6dd2c266..0999494c71 100644 --- a/platypush/install/docker/fedora.Dockerfile +++ b/platypush/install/docker/fedora.Dockerfile @@ -1,11 +1,21 @@ FROM fedora -ADD . /install WORKDIR /var/lib/platypush ARG DOCKER_CTX=1 ENV DOCKER_CTX=1 +RUN --mount=type=bind,source=.,target=/curdir \ + # 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 \ + dnf install -y git && \ + git clone https://github.com/blacklight/platypush.git /install; \ + fi + # Enable the RPM Fusion repository RUN dnf install -y https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm && \ /install/platypush/install/scripts/fedora/install.sh && \ diff --git a/platypush/install/docker/ubuntu.Dockerfile b/platypush/install/docker/ubuntu.Dockerfile index 36ee03f49b..65e86b4c24 100644 --- a/platypush/install/docker/ubuntu.Dockerfile +++ b/platypush/install/docker/ubuntu.Dockerfile @@ -1,6 +1,5 @@ FROM ubuntu -ADD . /install WORKDIR /var/lib/platypush ARG DEBIAN_FRONTEND=noninteractive @@ -8,8 +7,19 @@ ENV DEBIAN_FRONTEND=noninteractive ARG DOCKER_CTX=1 ENV DOCKER_CTX=1 -RUN apt update && \ - /install/platypush/install/scripts/debian/install.sh && \ +RUN --mount=type=bind,source=.,target=/curdir \ + apt 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 \ + apt install -y git && \ + git clone https://github.com/blacklight/platypush.git /install; \ + fi + +RUN /install/platypush/install/scripts/debian/install.sh && \ cd /install && \ pip install -U --no-input --no-cache-dir . --break-system-packages && \ rm -rf /install && \