Compare commits

...

5 Commits

Author SHA1 Message Date
Jack Henschel
ddef75c29c fix tags 2021-11-28 10:57:37 +01:00
Jack Henschel
7ca383e461 [undo] remove other tests 2021-11-28 10:54:26 +01:00
Markus Opolka
19a387488a Move entrypoint to /usr/local/bin (#104)
* Move entrypoint to /usr/local/bin

 - so that it's not served by the webserver
2021-11-25 07:56:11 +01:00
Markus Opolka
19a1a0d044 Extend example nginx.conf to include more protected paths (#103) 2021-11-25 07:55:47 +01:00
Mark
624a17b9fc Add depends_on for nginx so it waits until the limesurvey app is ready (#102)
By adding a depends_on in lime-web, it will wait for the limesurvey app to be ready to accept connections.
2021-11-24 09:30:51 +01:00
15 changed files with 21 additions and 267 deletions

View File

@@ -1,30 +1,10 @@
name: Publish Latest Container Images name: Publish Latest Container Images
on: on: [push, pull_request]
push:
tags:
- '5.*'
jobs: jobs:
lint_dockerfiles:
name: Lint Dockerfile with hadolint
runs-on: ubuntu-latest
strategy:
matrix:
dockerfile:
- 5.0/apache/Dockerfile
- 5.0/fpm-alpine/Dockerfile
- 5.0/fpm/Dockerfile
steps:
- uses: actions/checkout@v2
- uses: hadolint/hadolint-action@v1.5.0
with:
dockerfile: ${{ matrix.dockerfile }}
ignore: DL4006 DL3008 DL3018
push_images_to_registries: push_images_to_registries:
name: Push Container Images to registries name: Push Container Images to registries
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [lint_dockerfiles]
environment: docker-build environment: docker-build
permissions: permissions:
packages: write packages: write
@@ -49,48 +29,8 @@ jobs:
images: | images: |
docker.io/martialblog/limesurvey docker.io/martialblog/limesurvey
tags: | tags: |
type=semver,pattern={{raw}},suffix=-apache type=match,pattern=(.+),group=1
type=semver,pattern={{major}},suffix=-apache type=match,pattern=^(\d+),group=1
flavor: | flavor: |
latest=false latest=false
- name: 'Build and push latest Apache container images' suffix=-apache
uses: docker/build-push-action@v2
with:
context: 5.0/apache
push: true
tags: ${{ steps.metadata-apache.outputs.tags }}
labels: ${{ steps.metadata-apache.outputs.labels }}
- name: 'FPM variant metadata'
id: metadata-fpm
uses: docker/metadata-action@v3
with:
images: |
docker.io/martialblog/limesurvey
tags: |
type=semver,pattern={{version}},suffix=-fpm
type=semver,pattern={{major}},suffix=-fpm
- name: 'Build and push latest fpm container images'
uses: docker/build-push-action@v2
with:
context: 5.0/fpm
push: true
tags: ${{ steps.metadata-fpm.outputs.tags }}
labels: ${{ steps.metadata-fpm.outputs.labels }}
- name: 'FPM Alpine variant metadata'
id: metadata-fpm-alpine
uses: docker/metadata-action@v3
with:
images: |
docker.io/martialblog/limesurvey
tags: |
type=semver,pattern={{version}},suffix=-fpm-alpine
type=semver,pattern={{major}},suffix=-fpm-alpine
- name: 'Build and push latest fpm-alpine container images'
uses: docker/build-push-action@v2
with:
context: 5.0/fpm-alpine
push: true
tags: ${{ steps.metadata-fpm-alpine.outputs.tags }}
labels: ${{ steps.metadata-fpm-alpine.outputs.labels }}

View File

@@ -1,96 +0,0 @@
name: Publish LTS Container Images
on:
push:
tags:
- '3.*'
jobs:
lint_dockerfiles:
name: 'Lint Dockerfile with hadolint'
runs-on: ubuntu-latest
strategy:
matrix:
dockerfile:
- 3.0/apache/Dockerfile
- 3.0/fpm-alpine/Dockerfile
- 3.0/fpm/Dockerfile
steps:
- uses: actions/checkout@v2
- uses: hadolint/hadolint-action@v1.5.0
with:
dockerfile: ${{ matrix.dockerfile }}
ignore: DL4006 DL3008 DL3018
push_images_to_registries:
name: 'Push container images to registries'
runs-on: ubuntu-latest
needs: [lint_dockerfiles]
environment: docker-build
permissions:
packages: write
contents: read
steps:
- name: 'Check out the repo'
uses: actions/checkout@v2
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v1
with:
buildkitd-flags: --debug
- name: 'Log in to DockerHub'
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: 'Apache variant metadata'
id: metadata-apache
uses: docker/metadata-action@v3
with:
images: |
docker.io/martialblog/limesurvey
tags: |
type=semver,pattern={{raw}},suffix=-apache
type=semver,pattern={{major}},suffix=-apache
flavor: |
latest=false
- name: 'Build and push LTS apache container images'
uses: docker/build-push-action@v2
with:
context: 3.0/apache
push: true
tags: ${{ steps.metadata-apache.outputs.tags }}
labels: ${{ steps.metadata-apache.outputs.labels }}
- name: 'FPM variant metadata'
id: metadata-fpm
uses: docker/metadata-action@v3
with:
images: |
docker.io/martialblog/limesurvey
tags: |
type=semver,pattern={{version}},suffix=-fpm
type=semver,pattern={{major}},suffix=-fpm
- name: 'Build and push LTS fpm container images'
uses: docker/build-push-action@v2
with:
context: 3.0/fpm
push: true
tags: ${{ steps.metadata-fpm.outputs.tags }}
labels: ${{ steps.metadata-apache.outputs.labels }}
- name: 'FPM Alpine variant metadata'
id: metadata-fpm-alpine
uses: docker/metadata-action@v3
with:
images: |
docker.io/martialblog/limesurvey
tags: |
type=semver,pattern={{version}},suffix=-fpm-alpine
type=semver,pattern={{major}},suffix=-fpm-alpine
- name: 'Build and push LTS fpm-alpine container images'
uses: docker/build-push-action@v2
with:
context: 3.0/fpm-alpine
push: true
tags: ${{ steps.metadata-fpm-alpine.outputs.tags }}
labels: ${{ steps.metadata-apache.outputs.labels }}

View File

@@ -1,24 +0,0 @@
---
name: Lint Dockerfile
on: [push, pull_request]
jobs:
lint:
name: Lint Dockerfile with hadolint
strategy:
matrix:
dockerfile:
- 3.0/apache/Dockerfile
- 3.0/fpm-alpine/Dockerfile
- 3.0/fpm/Dockerfile
- 5.0/apache/Dockerfile
- 5.0/fpm-alpine/Dockerfile
- 5.0/fpm/Dockerfile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: hadolint/hadolint-action@v1.5.0
with:
dockerfile: ${{ matrix.dockerfile }}
ignore: DL4006 DL3008 DL3018

View File

@@ -1,34 +0,0 @@
name: Test Latest Container Images
on: [push, pull_request]
jobs:
test_images:
name: Test Latest Container Images with Trivy
runs-on: ubuntu-latest
strategy:
matrix:
context:
- apache
- fpm-alpine
- fpm
steps:
- name: 'Check out the repo'
uses: actions/checkout@v2
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v1
- name: 'Build Container images'
uses: docker/build-push-action@v2
with:
context: 5.0/${{ matrix.context }}
push: false
load: true
tags: docker.io/martialblog/limesurvey:5-${{ matrix.context }}
- name: 'Run Structure tests'
uses: plexsystems/container-structure-test-action@v0.2.0
with:
image: docker.io/martialblog/limesurvey:5-${{ matrix.context }}
config: tests/${{ matrix.context }}-tests.yaml

View File

@@ -1,34 +0,0 @@
name: Test LTS Container Images
on: [push, pull_request]
jobs:
test_images:
name: Test LTS Container Images with Trivy
runs-on: ubuntu-latest
strategy:
matrix:
context:
- apache
- fpm-alpine
- fpm
steps:
- name: 'Check out the repo'
uses: actions/checkout@v2
- name: 'Set up Docker Buildx'
uses: docker/setup-buildx-action@v1
- name: 'Build Container images'
uses: docker/build-push-action@v2
with:
context: 3.0/${{ matrix.context }}
push: false
load: true
tags: docker.io/martialblog/limesurvey:3-${{ matrix.context }}
- name: 'Run Structure tests'
uses: plexsystems/container-structure-test-action@v0.2.0
with:
image: docker.io/martialblog/limesurvey:3-${{ matrix.context }}
config: tests/${{ matrix.context }}-tests.yaml

View File

@@ -75,8 +75,8 @@ RUN set -ex; \
chown -R www-data:www-data /var/www/html /etc/apache2 chown -R www-data:www-data /var/www/html /etc/apache2
WORKDIR /var/www/html WORKDIR /var/www/html
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY vhosts-access-log.conf /etc/apache2/conf-enabled/other-vhosts-access-log.conf COPY vhosts-access-log.conf /etc/apache2/conf-enabled/other-vhosts-access-log.conf
USER $USER USER $USER
ENTRYPOINT ["/var/www/html/entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View File

@@ -52,6 +52,6 @@ RUN set -ex; \
EXPOSE 9000 EXPOSE 9000
WORKDIR /var/www/html WORKDIR /var/www/html
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/var/www/html/entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

View File

@@ -62,6 +62,6 @@ RUN set -ex; \
EXPOSE 9000 EXPOSE 9000
WORKDIR /var/www/html WORKDIR /var/www/html
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/var/www/html/entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

View File

@@ -78,8 +78,8 @@ RUN set -ex; \
EXPOSE $LISTEN_PORT EXPOSE $LISTEN_PORT
WORKDIR /var/www/html WORKDIR /var/www/html
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh
COPY vhosts-access-log.conf /etc/apache2/conf-enabled/other-vhosts-access-log.conf COPY vhosts-access-log.conf /etc/apache2/conf-enabled/other-vhosts-access-log.conf
USER $USER USER $USER
ENTRYPOINT ["/var/www/html/entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["apache2-foreground"] CMD ["apache2-foreground"]

View File

@@ -54,7 +54,7 @@ RUN set -ex; \
EXPOSE 9000 EXPOSE 9000
WORKDIR /var/www/html WORKDIR /var/www/html
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh
USER $USER USER $USER
ENTRYPOINT ["/var/www/html/entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

View File

@@ -63,7 +63,7 @@ RUN set -ex; \
EXPOSE 9000 EXPOSE 9000
WORKDIR /var/www/html WORKDIR /var/www/html
COPY entrypoint.sh entrypoint.sh COPY entrypoint.sh /usr/local/bin/entrypoint.sh
USER $USER USER $USER
ENTRYPOINT ["/var/www/html/entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
CMD ["php-fpm"] CMD ["php-fpm"]

View File

@@ -20,6 +20,8 @@ services:
image: nginx:alpine image: nginx:alpine
links: links:
- limesurvey - limesurvey
depends_on:
- limesurvey
ports: ports:
- "8080:80" - "8080:80"
volumes: volumes:

View File

@@ -19,7 +19,7 @@ http {
location / { location / {
try_files $uri /index.php?$args; try_files $uri /index.php?$args;
} }
location ~ ^/(protected|framework|themes/\w+/views) { location ~ ^/(protected|application|framework|themes/\w+/views) {
deny all; deny all;
} }
location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ {

View File

@@ -9,7 +9,7 @@ fileContentTests:
path: '/var/www/html/admin/index.php' path: '/var/www/html/admin/index.php'
expectedContents: ['LimeSurvey'] expectedContents: ['LimeSurvey']
- name: 'Entrypoint file content' - name: 'Entrypoint file content'
path: '/var/www/html/entrypoint.sh' path: '/usr/local/bin/entrypoint.sh'
expectedContents: ['console.php', 'ADMIN_USER'] expectedContents: ['console.php', 'ADMIN_USER']
fileExistenceTests: fileExistenceTests:

View File

@@ -9,7 +9,7 @@ fileContentTests:
path: '/var/www/html/admin/index.php' path: '/var/www/html/admin/index.php'
expectedContents: ['LimeSurvey'] expectedContents: ['LimeSurvey']
- name: 'Entrypoint file content' - name: 'Entrypoint file content'
path: '/var/www/html/entrypoint.sh' path: '/usr/local/bin/entrypoint.sh'
expectedContents: ['console.php', 'ADMIN_USER'] expectedContents: ['console.php', 'ADMIN_USER']
fileExistenceTests: fileExistenceTests: