Skip to content

Commit

Permalink
docker: add alpine,debian,ubuntu test images
Browse files Browse the repository at this point in the history
Relates to shaarli#843

Added:
- Makefile target to run commands in a Docker test context
- Docker images to run Shaarli test suites:
  - Alpine 3.6
  - Debian 8 & 9
  - Ubuntu 16.04

TODO:
- Add/update usage documentation

Signed-off-by: VirtualTam <virtualtam@flibidi.net>
  • Loading branch information
virtualtam committed Jul 29, 2017
1 parent fccfa09 commit 205204a
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ PHP_COMMA_SOURCE = index.php,application,tests,plugins

all: static_analysis_summary check_permissions test

##
# Docker test adapter
#
# Shaarli sources and vendored libraries are copied from a shared volume
# to a user-owned directory to enable running tests as a non-root user.
##
docker_%:
rsync -az /shaarli/ ~/shaarli/
cd ~/shaarli && make $*

##
# Concise status of the project
# These targets are non-blocking: || exit 0
Expand Down Expand Up @@ -206,4 +216,3 @@ htmlpages:
rm -r venv

doc_html: authors htmlpages

34 changes: 34 additions & 0 deletions docker/test/alpine36/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM alpine:3.6
MAINTAINER Shaarli Community

RUN apk --update --no-cache add \
ca-certificates \
curl \
make \
php7 \
php7-ctype \
php7-curl \
php7-dom \
php7-gd \
php7-iconv \
php7-intl \
php7-json \
php7-mbstring \
php7-openssl \
php7-phar \
php7-session \
php7-simplexml \
php7-tokenizer \
php7-xdebug \
php7-xml \
php7-zlib \
rsync

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

RUN mkdir /shaarli
WORKDIR /shaarli
VOLUME /shaarli

ENTRYPOINT ["make"]
CMD []
5 changes: 5 additions & 0 deletions docker/test/alpine36/IMAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## shaarli:latest
- [Debian 8 Jessie](https://hub.docker.com/_/debian/)
- [PHP5-FPM](http://php-fpm.org/)
- [Nginx](http://nginx.org/)
- [Shaarli](https://github.com/shaarli/Shaarli)
35 changes: 35 additions & 0 deletions docker/test/debian8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM debian:jessie
MAINTAINER Shaarli Community

ENV TERM dumb
ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
locales \
make \
php5 \
php5-curl \
php5-gd \
php5-intl \
php5-xdebug \
rsync \
&& apt-get clean

RUN locale-gen en_US.UTF-8 \
&& locale-gen de_DE.UTF-8 \
&& locale-gen fr_FR.UTF-8

ADD https://getcomposer.org/composer.phar /usr/local/bin/composer
RUN chmod 755 /usr/local/bin/composer

RUN mkdir /shaarli
WORKDIR /shaarli
VOLUME /shaarli

ENTRYPOINT ["make"]
CMD []
36 changes: 36 additions & 0 deletions docker/test/debian9/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM debian:stretch
MAINTAINER Shaarli Community

ENV TERM dumb
ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
locales \
make \
php7.0 \
php7.0-curl \
php7.0-gd \
php7.0-intl \
php7.0-xml \
php-xdebug \
rsync \
&& apt-get clean

RUN locale-gen en_US.UTF-8 \
&& locale-gen de_DE.UTF-8 \
&& locale-gen fr_FR.UTF-8

ADD https://getcomposer.org/composer.phar /usr/local/bin/composer
RUN chmod 755 /usr/local/bin/composer

RUN mkdir /shaarli
WORKDIR /shaarli
VOLUME /shaarli

ENTRYPOINT ["make"]
CMD []
36 changes: 36 additions & 0 deletions docker/test/ubuntu16/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:16.04
MAINTAINER Shaarli Community

ENV TERM dumb
ENV DEBIAN_FRONTEND noninteractive
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
language-pack-de \
language-pack-en \
language-pack-fr \
locales \
make \
php7.0 \
php7.0-curl \
php7.0-gd \
php7.0-intl \
php7.0-xml \
php-xdebug \
rsync \
&& apt-get clean

ADD https://getcomposer.org/composer.phar /usr/local/bin/composer
RUN chmod 755 /usr/local/bin/composer

RUN useradd -m dev \
&& mkdir /shaarli
USER dev
WORKDIR /shaarli

ENTRYPOINT ["make"]
CMD []

0 comments on commit 205204a

Please sign in to comment.