Skip to content

Commit

Permalink
Merge pull request #1156 from virtualtam/v0.8-dockerfile
Browse files Browse the repository at this point in the history
v0.8 - Build the Docker image from the local sources
  • Loading branch information
virtualtam authored Jun 20, 2018
2 parents c648fc3 + 55346c1 commit 9e42595
Show file tree
Hide file tree
Showing 19 changed files with 112 additions and 298 deletions.
File renamed without changes.
17 changes: 9 additions & 8 deletions docker/development/nginx.conf → .docker/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,6 @@ http {
access_log /var/log/nginx/shaarli.access.log;
error_log /var/log/nginx/shaarli.error.log;

location /phpinfo/ {
# add a PHP info page for convenience
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/index.php;
include fastcgi_params;
}

location ~ /\. {
# deny access to dotfiles
access_log off;
Expand All @@ -56,7 +48,16 @@ http {
alias /var/www/shaarli/images/favicon.ico;
}

location / {
# Slim - rewrite URLs
try_files $uri /index.php$is_args$args;
}

location ~ (index)\.php$ {
# Slim - split URL path into (script_filename, path_info)
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;

# filter and proxy PHP requests to PHP-FPM
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
Expand Down
File renamed without changes.
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Docker-ignore
# Note: .git/ is kept for HTML documentation generation
tests

# Shaarli runtime resources
cache/*
data/*
pagecache/*
tmp/*

# Eclipse project files
.settings
.buildpath
.project

# Raintpl generated pages
*.rtpl.php

# 3rd-party dependencies
composer.lock
vendor/

# Release archives
*.tar
*.zip

# Development and test resources
coverage
doxygen
sandbox
phpmd.html

# User plugin configuration
plugins/*/config.php
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ Dockerfile text
.travis.yml export-ignore
doc/**/*.json export-ignore
doc/**/*.md export-ignore
docker/ export-ignore
.docker/ export-ignore
.dockerignore export-ignore
Dockerfile export-ignore
Doxyfile export-ignore
Makefile export-ignore
phpunit.xml export-ignore
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ php:
- 5.6
- 5.5
- 5.4
- 5.3
# - 5.3 # Not supported by Travis CI
install:
- composer self-update
- composer install --prefer-dist
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [v0.8.7](https://github.com/shaarli/Shaarli/releases/tag/v0.8.7) - UNPUBLISHED
### Changed
- Build the Docker image from the local Git sources

### Removed
- Disable PHP 5.3 Travis build (unsupported)

## [v0.8.6](https://github.com/shaarli/Shaarli/releases/tag/v0.8.5) - 2018-02-19

## [v0.8.6](https://github.com/shaarli/Shaarli/releases/tag/v0.8.6) - 2018-02-19
### Changed
- Run version check tests against the 'stable' branch

Expand Down
50 changes: 50 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Stage 1:
# - Get Shaarli sources
# - Build documentation
FROM dalibo/pandocker:stable as docs
ADD . /pandoc/shaarli
RUN cd /pandoc/shaarli \
&& make htmldoc \
&& rm -rf .git

# Stage 2:
# - Resolve PHP dependencies with Composer
FROM composer:latest as composer
COPY --from=docs /pandoc/shaarli /app/shaarli
RUN cd shaarli \
&& composer --prefer-dist --no-dev install

# Stage 3:
# - Shaarli image
FROM debian:jessie
LABEL maintainer="Shaarli Community"

ENV TERM dumb
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
nginx-light \
php5-curl \
php5-fpm \
php5-gd \
php5-intl \
supervisor \
&& apt-get clean

RUN sed -i 's/post_max_size.*/post_max_size = 10M/' /etc/php5/fpm/php.ini \
&& sed -i 's/upload_max_filesize.*/upload_max_filesize = 10M/' /etc/php5/fpm/php.ini

COPY .docker/nginx.conf /etc/nginx/nginx.conf
COPY .docker/supervised.conf /etc/supervisor/conf.d/supervised.conf

WORKDIR /var/www
COPY --from=composer /app/shaarli shaarli
RUN rm -rf html \
&& chown -R www-data:www-data .

VOLUME /var/www/shaarli/data

EXPOSE 80

CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# - install Xdebug for PHPUnit code coverage reports:
# - see http://xdebug.org/docs/install
# - enable in php.ini
SHELL := /bin/bash

BIN = vendor/bin
PHP_SOURCE = index.php application tests plugins
Expand Down Expand Up @@ -203,14 +204,18 @@ htmlsidebar:
htmlpages:
@for file in `find doc/ -maxdepth 1 -name "*.md"`; do \
base=`basename $$file .md`; \
sed -i "1i #$${base//-/ }" $$file; \
sed -i "1i # $${base//-/ }" $$file; \
awk 'BEGIN { FS = "[\\[\\]]{2}" }'\
'm = /\[/ { t=$$2; gsub(/ /, "-", $$2); print $$1"["t"]("$$2".html)"$$3 }'\
'!m { print $$0 }' $$file > doc/tmp.md; \
mv doc/tmp.md $$file; \
pandoc -f markdown_github -t html5 -s \
pandoc -f gfm \
-t html5 \
-s \
-c "github-markdown.css" \
-T Shaarli -M pagetitle:"$${base//-/ }" -B doc/sidebar.html \
-T Shaarli \
-M pagetitle:"$${base//-/ }" \
-B doc/sidebar.html \
-o doc/$$base.html $$file; \
done;

Expand Down
38 changes: 0 additions & 38 deletions docker/development/Dockerfile

This file was deleted.

10 changes: 0 additions & 10 deletions docker/development/IMAGE.md

This file was deleted.

37 changes: 0 additions & 37 deletions docker/production/Dockerfile

This file was deleted.

5 changes: 0 additions & 5 deletions docker/production/IMAGE.md

This file was deleted.

63 changes: 0 additions & 63 deletions docker/production/nginx.conf

This file was deleted.

37 changes: 0 additions & 37 deletions docker/production/stable/Dockerfile

This file was deleted.

5 changes: 0 additions & 5 deletions docker/production/stable/IMAGE.md

This file was deleted.

Loading

0 comments on commit 9e42595

Please sign in to comment.