Compare commits

...

24 Commits

Author SHA1 Message Date
Markus Opolka
338d5b49d7 Updating to Version 3.8.2+180529 2018-06-04 19:17:13 +02:00
Markus Opolka
806f92df4b Updating to Version 3.8.1+180524 2018-05-29 21:03:40 +02:00
Markus Opolka
107c57f82c Updating to Version 3.8.0+180522 2018-05-25 09:29:05 +02:00
Markus Opolka
8d96eee149 Updating to Version 3.7.3+180516 2018-05-23 08:51:38 +02:00
Markus Opolka
038ccda1f5 Update container-structure-test download path 2018-05-16 12:59:05 +02:00
Markus Opolka
4cf3ada28d Updating to Version 3.7.2+180508 2018-05-16 12:00:26 +02:00
Markus Opolka
1422a7f90c Updating to Version 3.7.1+180424 2018-05-09 09:47:34 +02:00
Markus Opolka
60c137bbb0 Update Update-Script 2018-05-03 18:11:24 +02:00
Markus Opolka
eab1b832b6 Add CONTRIBUTING.md 2018-04-30 13:47:22 +02:00
Markus Opolka
89068ea89d Merge pull request #6 from martialblog/extend-tests
Add container-structore tests
2018-04-30 13:13:07 +02:00
Markus Opolka
c7f1bee380 Add container-structore tests
- Fixes issue #4
2018-04-30 13:06:19 +02:00
Markus Opolka
cb3f54eb90 Add requirements file for Python 2018-04-24 16:06:14 +02:00
Markus Opolka
f143587953 Update to Version 3.7.0+180418 2018-04-24 16:04:53 +02:00
Markus Opolka
b1fdd3fc64 Update to Version 3.6.3+180416 2018-04-18 17:24:55 +02:00
Markus Opolka
84ac1699df Add Update Script 2018-04-16 12:10:50 +02:00
Markus Opolka
b6449a4c22 Update to Version 3.6.2+180406 2018-04-16 12:08:48 +02:00
Markus Opolka
b87a6f75ac Upgrade to Version 3.6.1+180329 2018-04-10 08:45:36 +02:00
Markus Opolka
7096496410 Update to Version 3.5.4+180320 2018-03-28 20:59:38 +02:00
Markus Opolka
cbce400815 Update to Version 3.5.3+180316 2018-03-21 07:51:51 +01:00
Markus Opolka
a7ff191922 Update to Version 3.5.2+180315 2018-03-16 09:44:53 +01:00
Markus Opolka
e14dc2d585 Update to Version 3.5.0+180309 2018-03-15 09:11:26 +01:00
Markus Opolka
798351b5aa Update to Version 3.4.4+180305 2018-03-11 20:46:44 +01:00
Markus Opolka
94c030a008 Update README 2018-03-09 14:24:52 +01:00
Markus Opolka
91d07cc52b Update README 2018-03-09 13:33:34 +01:00
10 changed files with 224 additions and 17 deletions

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
\#*
.\#*
.venv/
container-structure-test

View File

@@ -2,9 +2,10 @@ sudo: required
language: bash
services:
- docker
matrix:
include:
- env: TEST=limesurvey-apache
script: docker build -t martialblog/limesurvey-apache -f apache/Dockerfile .
- env: TEST=limesurvey-fpm
script: docker build -t martialblog/limesurvey-fpm -f fpm/Dockerfile .
- env: TAG=martialblog/limesurvey-apache
script: docker build -q -t $TAG -f apache/Dockerfile . && tests/run.sh $TAG
- env: TAG=martialblog/limesurvey-fpm
script: docker build -q -t $TAG -f fpm/Dockerfile . && tests/run.sh $TAG

34
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,34 @@
# Contributing
Every Pull Request is welcome.
## Upgrading the Version
To upgrade the LimeSurvey Version the ARG variable needs to be changed.
```bash
$ grep Agrep ARG apache/Dockerfile
ARG version='3.7.0+180418'
```
Since this is a reoccuring and boring task, a script is provided.
```bash
# Dependencies
python3 -m venv .venv
source .venv/bin/activate
pip3 install -r requirements.txt
# Upgrades to latest Limesurvey version
./upgrade.py
```
## Testing
In order to make sure the image works as promised, some tests are provided:
```bash
./tests/run.sh
```
For further information: https://github.com/GoogleContainerTools/container-structure-test

View File

@@ -3,19 +3,11 @@
# LimeSurvey Docker
Dockerfile to build a [LimeSurvey](https://limesurvey.org) image for the Docker container platform.
Dockerfile to build a [LimeSurvey](https://limesurvey.org) Image for the Docker container platform.
# Uploads Persistence
# Using the apache image
To preserve the uploaded files assign the upload folder into a volume. See *docker-compose.yml* for details.
# LimeSurvey Configuration
To change to LimeSuvey configuration simply mount a Volume into the Container at:
- /var/www/html/application/config/config.php
**Hint**: If this configuration is present, the LimeSuvery Installer will not run.
The apache image comes with an Apache Webserver and PHP installed.
# Apache Configuration
@@ -24,3 +16,28 @@ To change to Apache Webserver configuration mount a Volume into the Container at
- /etc/apache2/sites-available/000-default.conf
See the example configuration provided.
# Using the fpm image
To use the fpm image you need an additional web server that can proxy http-request to the fpm-port of the container.
# Using an external database
LimeSurvey requires an external database (MySQL, PostgreSQL) to run. See *docker-compose.yml* for example.
# Persistent data
To preserve the uploaded files assign the upload folder into a volume. See *docker-compose.yml* for details.
# LimeSurvey Configuration
To change to LimeSurvey configuration simply mount a Volume into the Container at:
- /my-data/config.php:/var/www/html/application/config/config.php
**Hint**: If this configuration is present, the LimeSurvey Installer will not run.
# References
- https://www.limesurvey.org/
- https://github.com/LimeSurvey/LimeSurvey/

View File

@@ -1,6 +1,6 @@
FROM php:7.2-apache
LABEL maintainer="markus@martialblog.de"
ARG version='3.4.3+180227'
ARG version='3.8.2+180529'
# Install OS dependencies
RUN apt-get update && \

View File

@@ -1,6 +1,6 @@
FROM php:7.2-fpm
LABEL maintainer="markus@martialblog.de"
ARG version='3.4.3+180227'
ARG version='3.8.2+180529'
# Install OS dependencies
RUN apt-get update && \

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
feedparser==5.2.1

77
tests/image_tests.yaml Normal file
View File

@@ -0,0 +1,77 @@
schemaVersion: "2.0.0"
globalEnvVars:
- key: "PATH"
value: "/env/bin:$PATH"
fileContentTests:
- name: 'Limesurvey admin file content'
path: '/var/www/html/admin/index.php'
expectedContents: ['LimeSurvey']
fileExistenceTests:
- name: 'Limesurvey files'
path: '/var/www/html/index.php'
shouldExist: true
permissions: '-rw-rw-r--'
- name: 'Limesurvey admin files'
path: '/var/www/html/admin/index.php'
shouldExist: true
permissions: '-rw-rw-r--'
- name: 'Ldap syslink'
path: '/usr/lib/x86_64-linux-gnu/libldap.so'
shouldExist: true
- name: "Dependencies - PHP - gd"
path: '/usr/local/etc/php/conf.d/docker-php-ext-gd.ini'
shouldExist: true
- name: "Dependencies - PHP - imap"
path: '/usr/local/etc/php/conf.d/docker-php-ext-imap.ini'
shouldExist: true
- name: "Dependencies - PHP - ldap"
path: '/usr/local/etc/php/conf.d/docker-php-ext-ldap.ini'
shouldExist: true
- name: "Dependencies - PHP - pgsql"
path: '/usr/local/etc/php/conf.d/docker-php-ext-pgsql.ini'
shouldExist: true
- name: "Dependencies - PHP - zip"
path: '/usr/local/etc/php/conf.d/docker-php-ext-zip.ini'
shouldExist: true
- name: "Dependencies - PHP - sodium"
path: '/usr/local/etc/php/conf.d/docker-php-ext-sodium.ini'
shouldExist: true
- name: "Dependencies - PHP - pdo_mysql"
path: '/usr/local/etc/php/conf.d/docker-php-ext-pdo_mysql.ini'
shouldExist: true
- name: "Dependencies - PHP - pdo_pgsql"
path: '/usr/local/etc/php/conf.d/docker-php-ext-pdo_pgsql.ini'
shouldExist: true
commandTests:
- name: "Dependencies - libldap2-dev"
command: "dpkg"
args: ["-l", "libldap2-dev"]
exitCode: 0
- name: "Dependencies - zlib1g-dev"
command: "dpkg"
args: ["-l", "zlib1g-dev"]
exitCode: 0
- name: "Dependencies - libc-client-dev"
command: "dpkg"
args: ["-l", "libc-client-dev"]
exitCode: 0
- name: "Dependencies - libkrb5-dev"
command: "dpkg"
args: ["-l", "libkrb5-dev"]
exitCode: 0
- name: "Dependencies - libpng-dev"
command: "dpkg"
args: ["-l", "libpng-dev"]
exitCode: 0
- name: "Dependencies - libpq-dev"
command: "dpkg"
args: ["-l", "libpq-dev"]
exitCode: 0
- name: "Dependencies - PHP Modules"
command: "php"
args: ["-m"]
expectedOutput: ["ldap", "zip", "pdo_mysql", "pdo_sqlite", "gd", "mbstring", "PDO", "imap"]

11
tests/run.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env bash
IMAGE=$1
if [ ! -f container-structure-test ]; then
curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64
mv container-structure-test-linux-amd64 container-structure-test
chmod +x container-structure-test
fi
./container-structure-test test --image $IMAGE --config tests/image_tests.yaml

61
upgrade.py Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/env python3
import argparse
import feedparser
import sys
import subprocess
dockerfile_apache = 'apache/Dockerfile'
dockerfile_fpm = 'fpm/Dockerfile'
limesv_feed_url = 'https://github.com/LimeSurvey/LimeSurvey/releases.atom'
docker_feed_url = 'https://github.com/martialblog/docker-limesurvey/releases.atom'
limesv_feed = feedparser.parse(limesv_feed_url)
docker_feed = feedparser.parse(docker_feed_url)
limesv_current_release = limesv_feed.entries[0].title_detail.value
docker_current_release = docker_feed.entries[0].title_detail.value
argumentparser = argparse.ArgumentParser(description='Updates the LimeSurvey Version in the Dockerfiles')
argumentparser.add_argument('--noop', dest='noop', action="store_true", required=False, help="Don't push just commit")
argumentparser.add_argument('--check', dest='check', action="store_true", required=False, help="Only check if there's a new version available")
cmdargs = argumentparser.parse_args()
if limesv_current_release == docker_current_release:
print('Nothing to do.')
sys.exit(0)
print('New Version {} available.'.format(limesv_current_release))
if cmdargs.check:
sys.exit(0)
commit_message = 'Updating to Version {}'.format(limesv_current_release)
# Dockerfiles
regexp = 's/[0-9]\.[0-9]\.[0-9]+[0-9]*/{new_version}/'.format(new_version=limesv_current_release)
subprocess.call(['sed', '-i', '-e', regexp, dockerfile_apache])
subprocess.call(['sed', '-i', '-e', regexp, dockerfile_fpm])
print('> Updated Dockerfiles')
# Git Commit/Tag
# subprocess.call(['git', 'checkout', '-b', limesv_current_release])
subprocess.call(['git', 'add', dockerfile_apache])
subprocess.call(['git', 'add', dockerfile_fpm])
subprocess.call(['git', 'commit', '-m', commit_message])
subprocess.call(['git', 'tag', limesv_current_release])
print('> Created new Commit and Tag')
if cmdargs.noop:
sys.exit(0)
# Git Push
# subprocess.call(['git', 'push', 'origin', limesv_current_release])
subprocess.call(['git', 'push'])
subprocess.call(['git', 'push', 'origin', '--tags'])
print('> Pushed to new Branch')
sys.exit(0)