Skip to content

Commit

Permalink
Merge pull request #273 from roundcube/renovate-nightly
Browse files Browse the repository at this point in the history
Renovate nightly
  • Loading branch information
pabzm authored Nov 14, 2024
2 parents 05b1cdb + cdfcb4c commit 32aca2c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 256 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/build-and-publish-nightly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build & Publish nightly

permissions:
contents: read

on:
schedule:
# Rebuild automatically each night
- cron: "* 4 * * *"

jobs:
build-and-testvariants:
name: Build image and run tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get docker hub username
id: creds
run: echo '::set-output name=username::${{ secrets.DOCKER_PULL_USERNAME }}'
- name: Login to Docker Hub
if: steps.creds.outputs.username != ''
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_PULL_USERNAME }}
password: ${{ secrets.DOCKER_PUSH_PASSWORD }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
buildkitd-flags: --debug

- name: Build and push nightly image"
uses: docker/build-push-action@v5
with:
platforms: "linux/arm64,linux/arm/v6,linux/arm/v7,linux/s390x,linux/ppc64le,linux/386,linux/amd64,"
push: true
tags: nightly
# does not work linux/arm/v5 AND linux/mips64le - composer does not support mips64le or armv5 nor does the php image support them on the alpine variant

- name: Run tests
env:
ROUNDCUBEMAIL_TEST_IMAGE: roundcube/roundcubemail:nightly
run: docker compose -f ./tests/docker-compose.test-apache-postgres.yml up --exit-code-from=sut --abort-on-container-exit
113 changes: 6 additions & 107 deletions nightly/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,107 +1,19 @@
FROM php:8.0-apache AS base
LABEL maintainer="Thomas Bruederli <[email protected]>"
LABEL org.opencontainers.image.source="https://github.com/roundcube/roundcubemail-docker"

RUN set -ex; \
apt-get update; \
\
savedAptMark="$(apt-mark showmanual)"; \
\
apt-get install -y --no-install-recommends \
libfreetype6-dev \
libicu-dev \
libjpeg62-turbo-dev \
libldap2-dev \
libmagickwand-dev \
libpng-dev \
libpq-dev \
libsqlite3-dev \
libzip-dev \
libpspell-dev \
libonig-dev \
libldap-common \
; \
\
debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)"; \
docker-php-ext-configure gd; \
docker-php-ext-configure ldap --with-libdir="lib/$debMultiarch"; \
docker-php-ext-install \
exif \
gd \
intl \
ldap \
pdo_mysql \
pdo_pgsql \
pdo_sqlite \
zip \
pspell \
; \
pecl install imagick redis; \
docker-php-ext-enable imagick opcache redis; \
\
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
apt-mark auto '.*' > /dev/null; \
apt-mark manual $savedAptMark; \
extdir="$(php -r 'echo ini_get("extension_dir");')"; \
ldd "$extdir"/*.so \
| awk '/=>/ { so = $(NF-1); if (index(so, "/usr/local/") == 1) { next }; gsub("^/(usr/)?", "", so); print so }' \
| sort -u \
| xargs -r dpkg-query -S \
| cut -d: -f1 \
| sort -u \
| xargs -rt apt-mark manual; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
rm -rf /var/lib/apt/lists/*; \
ldd "$extdir"/*.so | grep -qzv "=> not found" || (echo "Sanity check failed: missing libraries:"; ldd "$extdir"/*.so | grep " => not found"; exit 1); \
ldd "$extdir"/*.so | grep -q "libzip.so.* => .*/libzip.so.*" || (echo "Sanity check failed: libzip.so is not referenced"; ldd "$extdir"/*.so; exit 1); \
err="$(php --version 3>&1 1>&2 2>&3)"; \
[ -z "$err" ] || (echo "Sanity check failed: php returned errors; $err"; exit 1;);


# installto.sh dependencies
RUN set -ex; \
\
apt-get update; \
apt-get install -y --no-install-recommends \
aspell \
aspell-en \
rsync \
unzip \
; \
rm -rf /var/lib/apt/lists/*

# ... and composer.phar
COPY --from=composer:2 /usr/bin/composer /usr/bin/composer

RUN a2enmod rewrite

### Temporary build image
FROM base AS builder
### Temporary build container to use npm in.
FROM docker.io/roundcube/roundcubemail:latest-apache AS builder

# install nodejs and lessc compiler
RUN apt-get -qq update; \
apt-get install -y --no-install-recommends unzip gnupg dirmngr git; \
curl -sL https://deb.nodesource.com/setup_20.x | bash -; \
apt-get install -y nodejs; \
npm install -g less; \
npm install -g uglify-js; \
npm install -g lessc; \
npm install -g less-plugin-clean-css; \
npm install -g csso-cli
RUN apt-get -qq update && apt-get install -y --no-install-recommends npm git

# Download source and build package into src directory
RUN set -ex; \
rm -rf /usr/src/roundcubemail; \
curl -o roundcubemail.tar.gz -SL https://github.com/roundcube/roundcubemail/archive/master.tar.gz; \
tar -xzf roundcubemail.tar.gz -C /usr/src/; \
rm roundcubemail.tar.gz; \
mv /usr/src/roundcubemail-master /usr/src/roundcubemail; \
cd /usr/src/roundcubemail; \
rm -rf installer tests public_html .ci .github .gitignore .editorconfig .tx .travis.yml; \
(cd /usr/src/roundcubemail/skins/elastic; \
lessc --clean-css="--s1 --advanced" styles/styles.less > styles/styles.min.css; \
lessc --clean-css="--s1 --advanced" styles/print.less > styles/print.css; \
lessc --clean-css="--s1 --advanced" styles/embed.less > styles/embed.css); \
make css-elastic; \
composer require kolab/net_ldap3 --no-install; \
composer require bjeavons/zxcvbn-php --no-install; \
composer install --no-dev --prefer-dist; \
Expand All @@ -120,20 +32,7 @@ RUN set -ex; \
temp/js_cache

### Final image
FROM base
FROM docker.io/roundcube/roundcubemail:latest-apache

RUN mkdir -p /usr/src
COPY --from=builder /usr/src/roundcubemail /usr/src/roundcubemail

# include the wait-for-it.sh script
RUN curl -fL https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh > /wait-for-it.sh && chmod +x /wait-for-it.sh

# use custom PHP settings
COPY php.ini /usr/local/etc/php/conf.d/roundcube-defaults.ini

COPY docker-entrypoint.sh /

RUN mkdir -p /var/roundcube/config

ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["apache2-foreground"]
139 changes: 0 additions & 139 deletions nightly/docker-entrypoint.sh

This file was deleted.

10 changes: 0 additions & 10 deletions nightly/php.ini

This file was deleted.

0 comments on commit 32aca2c

Please sign in to comment.