# This Dockerfile was automatically generated by Platydock.
#
# You can build a Platypush image from it by running
# `docker build -t platypush .` in the same folder as this file,
# or copy it to the root a Platypush source folder to install the
# checked out version instead of downloading it first.
#
# You can then run your new image through:
#   docker run --rm --name platypush \
#       -v /path/to/your/config/dir:/etc/platypush \
#       -v /path/to/your/workdir:/var/lib/platypush \
#       -p 8008:8008 \
#       platypush


FROM alpine

ADD . /install
WORKDIR /var/lib/platypush

ARG DOCKER_CTX=1
ENV DOCKER_CTX=1

RUN apk update

RUN if [ ! -f "/install/setup.py" ]; then \
  echo "Platypush source not found under the current directory, downloading it" && \
      apk add --update --no-interactive --no-cache git && \
      rm -rf /install && \
      git clone --recursive https://github.com/BlackLight/platypush.git /install && \
      cd /install && \
      git checkout master && \
      apk del --no-interactive git; \
fi

RUN /install/platypush/install/scripts/alpine/install.sh
RUN cd /install && pip install -U --no-input --no-cache-dir .
RUN rm -rf /install
RUN rm -rf /var/cache/apk

EXPOSE 8008

VOLUME /etc/platypush
VOLUME /var/lib/platypush


# You can customize the name of your installation by passing
# --device-id=... to the launched command.

CMD platypush \
  --start-redis \
  --config /etc/platypush/config.yaml \
  --workdir /var/lib/platypush