From: Jerome Jutteau Date: Mon, 4 Sep 2017 19:31:42 +0000 (+0200) Subject: [FEATURE] Add docker image support X-Git-Tag: 3.3.0~8 X-Git-Url: https://git.p6c8.net/jirafeau_project.git/commitdiff_plain/d76baeb068461f6f27c40a2fed1eae56586f08a7?ds=sidebyside [FEATURE] Add docker image support closes #114 Signed-off-by: Jerome Jutteau --- diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a950963 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,25 @@ +FROM php:7.1.1-fpm-alpine +MAINTAINER "Jérôme Jutteau " + +RUN apk update && \ + apk add lighttpd git && \ + ln -snf /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ + echo "UTC" > /etc/timezone && \ + mkdir -p /usr/local/etc/php / && \ + mkdir /www + +WORKDIR /www + +COPY docker/php.ini /usr/local/etc/php/php.ini +COPY docker/lighttpd.conf /etc/lighttpd/lighttpd.conf +COPY *.php LICENSE.txt ./ +COPY lib lib +COPY media media + +RUN chown -R www-data. . && \ + chmod o=,ug=rwX -R . && \ + apk del git && \ + rm -rf /var/cache/apk/* + +CMD php-fpm -D && lighttpd -D -f /etc/lighttpd/lighttpd.conf +EXPOSE 80 diff --git a/README.md b/README.md index d9ac583..c62e252 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,10 @@ Jirafeau project won't evolve to a file manager and will focus to keep a very fe ## Installation +This shows how to install Jirafeau by your own, it's quite simple but you can +also use a [docker image](https://hub.docker.com/r/mojo42/jirafeau/) or build +it yourself. Check [docker folder](docker/README.md) for more informations. + System requirements: - PHP >= 5.6 - Optional, but recommended: Git >= 2.7 diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..5dc4c2c --- /dev/null +++ b/docker/README.md @@ -0,0 +1,38 @@ +# Jirafeau in Docker + +Jirafeau is a small PHP application so running it inside a docker is pretty straightforward. + +## Get Jirafeau's docker image + +### Pull docker image from Docker Hub + +`docker pull mojo42/jirafeau` + +### Build your own docker image + +``` +git clone https://gitlab.com/mojo42/Jirafeau.git +cd Jirafeau +docker build -t mojo42/jirafeau:latest . +``` + +## Run Jirafeau image + +Once you have your Jirafeau's image, you can run a quick & dirty Jirafeau using: +``` +docker run -d -p 8000:80 mojo42/jirafeau +``` +and then connect on [locahost:8000](http://localhost:8000) and proceed to installation. + +An other way to run Jirafeau (in a more controlled way) is to mount your Jirafeau's reprository in /www folder so your data are outside the container. This way, you will be able to easily make backups, upgrade Jirafeau, change configuration and develop Jirafeau. +``` +docker run -d -p 8000:80 -v$(pwd):/www mojo42/jirafeau +``` + +There are also other ways to manage your container (like docker's volumes) but this is out of the scope of this documentation. + +## Few notes + +- SSL is currently not enabled in docker's image for the moment +- `var-...` folder where lives all uploaded data is protected from direct access +- Image has been made using [Alpine Linux](https://alpinelinux.org/) with [lighttpd](https://www.lighttpd.net/) which makes the container very light and start very quickly diff --git a/docker/lighttpd.conf b/docker/lighttpd.conf new file mode 100644 index 0000000..0e4bb5d --- /dev/null +++ b/docker/lighttpd.conf @@ -0,0 +1,34 @@ +var.basedir = "/www" +var.logdir = "/var/log/lighttpd" +var.statedir = "/var/lib/lighttpd" + +server.modules = ( + "mod_access", + "mod_usertrack", + "mod_expire", + "mod_accesslog" +) + +include "mime-types.conf" +include "mod_fastcgi_fpm.conf" + +server.username = "lighttpd" +server.groupname = "lighttpd" + +server.pid-file = "/run/lighttpd.pid" +server.errorlog = var.logdir + "/error.log" +server.indexfiles = ("index.php", "index.html", "index.htm") +server.follow-symlink = "enable" +server.document-root = var.basedir + +dir-listing.show-header = "disable" +dir-listing.hide-header-file = "enable" +dir-listing.activate = "disable" + +static-file.exclude-extensions = (".php") + +accesslog.filename = var.logdir + "/access.log" +url.access-deny = ("~", ".inc") +$HTTP["url"] =~ "^/var-*" { + url.access-deny = ("") +} diff --git a/docker/php.ini b/docker/php.ini new file mode 100644 index 0000000..f4f5ac2 --- /dev/null +++ b/docker/php.ini @@ -0,0 +1,2 @@ +date.timezone = UTC +display_errors = stderr