diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5193485 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,53 @@ +name: Monica's docker + +on: [push] + +jobs: + build: + runs-on: ${{ matrix.operating-system }} + strategy: + fail-fast: false + matrix: + operating-system: [ubuntu-latest] + variant: [apache, fpm, fpm-alpine] + arch: [amd64, i386] + + steps: + - uses: actions/checkout@v2 + - uses: actions/checkout@v2 + with: + repository: 'docker-library/official-images' + path: 'official-images' + + - name: Fix image + if: matrix.arch == 'i386' + run: | + sed -i -e 's/FROM php/FROM i386\/php/g' "${{ matrix.variant }}/Dockerfile" + + - name: Build image ${{ matrix.variant }} ${{ matrix.arch }} + run: | + docker build ${{ matrix.variant }} -t monica:${{ matrix.variant }} + docker images + + - name: Test image ${{ matrix.variant }} ${{ matrix.arch }} + run: | + official-images/test/run.sh monica:${{ matrix.variant }} + + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Test update script + run: | + hash_before=$(git write-tree) + ./update.sh + bash -c "[[ $hash_before = $(git add -A && git write-tree) ]]" + + - name: Install bashbrew + run: | + curl -fsSL -o bashbrew https://doi-janky.infosiftr.net/job/bashbrew/lastSuccessfulBuild/artifact/bin/bashbrew-amd64 + chmod +x "bashbrew" + echo "::add-path::$(pwd)" + - name: Run stackbrew + run: | + ./generate-stackbrew-library.sh diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 6fd8d6e..db9cdc1 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -1,12 +1,6 @@ FROM php:%%PHP_VERSION%%-%%VARIANT%% -LABEL maintainer="Alexis Saettler (@asbiin)" \ - org.label-schema.name="MonicaHQ, the Personal Relationship Manager" \ - org.label-schema.description="This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you." \ - org.label-schema.url="https://monicahq.com" \ - org.label-schema.vcs-url="https://github.com/monicahq/monica" \ - org.label-schema.vendor="Monica" \ - org.label-schema.schema-version="1.0" +%%LABEL%% # entrypoint.sh dependencies RUN set -ex; \ @@ -15,7 +9,8 @@ RUN set -ex; \ bash \ coreutils \ rsync \ - ; + ; \ + rm -rf /var/cache/apk/* # Install required PHP extensions RUN set -ex; \ @@ -76,7 +71,8 @@ RUN set -ex; \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ )"; \ apk add --virtual .monica-phpext-rundeps $runDeps; \ - apk del .build-deps + apk del .build-deps; \ + rm -rf /var/cache/apk/* # Set crontab for schedules RUN set -ex; \ @@ -130,7 +126,8 @@ RUN set -ex; \ cp /usr/src/monica/.env.example /usr/src/monica/.env; \ chown -R www-data:www-data /usr/src/monica; \ \ - apk del .fetch-deps + apk del .fetch-deps; \ + rm -rf /var/cache/apk/* COPY upgrade.exclude \ /usr/local/share/ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 2e32a9f..0c7bc0d 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -1,17 +1,12 @@ FROM php:%%PHP_VERSION%%-%%VARIANT%% -LABEL maintainer="Alexis Saettler (@asbiin)" \ - org.label-schema.name="MonicaHQ, the Personal Relationship Manager" \ - org.label-schema.description="This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you." \ - org.label-schema.url="https://monicahq.com" \ - org.label-schema.vcs-url="https://github.com/monicahq/monica" \ - org.label-schema.vendor="Monica" \ - org.label-schema.schema-version="1.0" +%%LABEL%% # entrypoint.sh dependencies RUN set -ex; \ \ apt-get update; \ + apt-get -y autoremove; \ apt-get install -y --no-install-recommends \ rsync \ bash \ @@ -82,7 +77,7 @@ RUN set -ex; \ | xargs -rt apt-mark manual; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + rm -rf /var/lib/apt/lists/*; \ \ if command -v a2enmod; then \ a2enmod rewrite; \ diff --git a/apache/Dockerfile b/apache/Dockerfile index 1ba437a..98da637 100644 --- a/apache/Dockerfile +++ b/apache/Dockerfile @@ -12,6 +12,7 @@ LABEL maintainer="Alexis Saettler (@asbiin)" \ RUN set -ex; \ \ apt-get update; \ + apt-get -y autoremove; \ apt-get install -y --no-install-recommends \ rsync \ bash \ @@ -82,7 +83,7 @@ RUN set -ex; \ | xargs -rt apt-mark manual; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + rm -rf /var/lib/apt/lists/*; \ \ if command -v a2enmod; then \ a2enmod rewrite; \ diff --git a/fpm-alpine/Dockerfile b/fpm-alpine/Dockerfile index 24cf082..3f58dea 100644 --- a/fpm-alpine/Dockerfile +++ b/fpm-alpine/Dockerfile @@ -15,7 +15,8 @@ RUN set -ex; \ bash \ coreutils \ rsync \ - ; + ; \ + rm -rf /var/cache/apk/* # Install required PHP extensions RUN set -ex; \ @@ -76,7 +77,8 @@ RUN set -ex; \ | awk 'system("[ -e /usr/local/lib/" $1 " ]") == 0 { next } { print "so:" $1 }' \ )"; \ apk add --virtual .monica-phpext-rundeps $runDeps; \ - apk del .build-deps + apk del .build-deps; \ + rm -rf /var/cache/apk/* # Set crontab for schedules RUN set -ex; \ @@ -130,7 +132,8 @@ RUN set -ex; \ cp /usr/src/monica/.env.example /usr/src/monica/.env; \ chown -R www-data:www-data /usr/src/monica; \ \ - apk del .fetch-deps + apk del .fetch-deps; \ + rm -rf /var/cache/apk/* COPY upgrade.exclude \ /usr/local/share/ diff --git a/fpm/Dockerfile b/fpm/Dockerfile index bda54e3..044a8f8 100644 --- a/fpm/Dockerfile +++ b/fpm/Dockerfile @@ -12,6 +12,7 @@ LABEL maintainer="Alexis Saettler (@asbiin)" \ RUN set -ex; \ \ apt-get update; \ + apt-get -y autoremove; \ apt-get install -y --no-install-recommends \ rsync \ bash \ @@ -82,7 +83,7 @@ RUN set -ex; \ | xargs -rt apt-mark manual; \ \ apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \ - rm -rf /var/lib/apt/lists/*; \ + rm -rf /var/lib/apt/lists/*; \ \ if command -v a2enmod; then \ a2enmod rewrite; \ diff --git a/update.sh b/update.sh index a600d89..eab36d2 100755 --- a/update.sh +++ b/update.sh @@ -28,6 +28,14 @@ RUN set -eu; sed -ri -e \"s!/var/www/html!\\\${APACHE_DOCUMENT_ROOT}!g\" /etc/ap [fpm-alpine]='' ) +label="LABEL maintainer=\"Alexis Saettler (@asbiin)\" \\\\\\n\ + org.label-schema.name=\"MonicaHQ, the Personal Relationship Manager\" \\\\\\n\ + org.label-schema.description=\"This is MonicaHQ, your personal memory! MonicaHQ is like a CRM but for the friends, family, and acquaintances around you.\" \\\\\\n\ + org.label-schema.url=\"https://monicahq.com\" \\\\\\n\ + org.label-schema.vcs-url=\"https://github.com/monicahq/monica\" \\\\\\n\ + org.label-schema.vendor=\"Monica\" \\\\\\n\ + org.label-schema.schema-version=\"1.0\"" + apcu_version="$( git ls-remote --tags https://github.com/krakjoe/apcu.git \ | cut -d/ -f3 \ @@ -78,6 +86,7 @@ for variant in apache fpm fpm-alpine; do s/%%VERSION%%/'"$version"'/; s/%%SHA512%%/'"$sha512"'/; s/%%CMD%%/'"${cmd[$variant]}"'/; + s#%%LABEL%%#'"$label"'#; s#%%APACHE_DOCUMENT%%#'"${document[$variant]}"'#; s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/; s/%%MEMCACHED_VERSION%%/'"${pecl_versions[memcached]}"'/;