From 44f78da52e97e569b6ab507ea85487e136487a94 Mon Sep 17 00:00:00 2001 From: "dario.martini" Date: Thu, 29 Nov 2018 15:48:17 +0800 Subject: [PATCH] Added Docker file and information to the README.md --- README.md | 25 +++++++++++++++++++++++++ docker/Dockerfile | 14 ++++++++++++++ docker/docker-entrypoint.sh | 18 ++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 docker/Dockerfile create mode 100755 docker/docker-entrypoint.sh diff --git a/README.md b/README.md index 6a8885a..f925221 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,31 @@ $ chmod +x Gitify Please see [the Installation wiki](https://github.com/modmore/Gitify/wiki/1.-Installation) for more details. +## Docker Usage + +### Example usage: + +``` +docker build -t gitify docker +docker run --rm -v "src:/var/www/html" gitify help +``` + +### Example docker-compose configuration: + +``` yaml +version: '3.1' + +services: + + [...] + + gitify: + build: docker + volumes: + - "./src:/var/www/html" +``` + +Notice: gitify's container needs to be able to access the database and the sourcecode of ModX. ## Documentation diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..cbb8aef --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,14 @@ +FROM composer:1.7.2 + +RUN git clone https://github.com/modmore/Gitify.git /usr/local/lib/gitify && \ + cd /usr/local/lib/gitify && \ + composer install && \ + ln -s /usr/local/lib/gitify/Gitify /usr/local/bin/Gitify && \ + mkdir /gitify +RUN apk --no-cache add mysql-client +RUN docker-php-ext-install pdo_mysql + +COPY docker-entrypoint.sh / +ENTRYPOINT ["/docker-entrypoint.sh"] +VOLUME ["/var/www/html", "/gitify"] +WORKDIR /var/www/html diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh new file mode 100755 index 0000000..6ea0a4d --- /dev/null +++ b/docker/docker-entrypoint.sh @@ -0,0 +1,18 @@ +#!/bin/sh +set -euo pipefail + +if [ "$#" -ne 1 ]; then + set -- Gitify +fi + +# first arg is a option +if [ "${1#-}" != "$1" ]; then + set -- Gitify "$@" +fi + +# if our command is a valid gitify subcommand, let's invoke it through gitify instead +if Gitify help "$1" > /dev/null 2>&1; then + set -- Gitify "$@" +fi + +exec "$@"