diff --git a/.github/workflows/container-image.yaml b/.github/workflows/container-image.yaml new file mode 100644 index 0000000..4334884 --- /dev/null +++ b/.github/workflows/container-image.yaml @@ -0,0 +1,48 @@ +name: roundcubemail-docker-dev image + +on: + push: + paths: + - 'Dockerfile' + - 'docker-entrypoint-dev.sh' + - '.github/workflows/container-image.yml' + schedule: + # Rebuild automatically each monday early morning + - cron: "42 3 * * 1" + +jobs: + build_and_push: + strategy: + fail-fast: false + + name: build and push + runs-on: ubuntu-latest + # Set the permissions granted to the GITHUB_TOKEN for the actions in this job. + permissions: + contents: read + packages: write + attestations: write + id-token: write + steps: + - name: Check actor permission + uses: skjnldsv/check-actor-permission@v2 + with: + require: admin + - name: Check out the repo + uses: actions/checkout@v4 + - name: Log in to the Container registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push Docker image + id: push + uses: docker/build-push-action@v2 + with: + context: . + push: true + #platforms: linux/amd64,linux/arm64 + tags: "ghcr.io/pabzm/roundcubemail-docker-dev:latest" + + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ca531cd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM docker.io/roundcube/roundcubemail + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update \ + && apt-get install -y --no-install-recommends npm git \ + && apt-get clean + +COPY --chmod=0755 docker-entrypoint-dev.sh / + +VOLUME /var/www/html + +ENTRYPOINT ["/docker-entrypoint-dev.sh"] + +# This CMD is from the upstream image, don't know why it needs to be repeated. +CMD ["apache2-foreground"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..e903bcf --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +Roundcubemail Docker Dev +======================== + +A container image to easily run Roundcubemail from its repository code. + +This image expects to be run with Roundcubemail's repository code mounted to `/var/www/html`, and prepares it to be runnable. diff --git a/docker-entrypoint-dev.sh b/docker-entrypoint-dev.sh new file mode 100644 index 0000000..bba7cd2 --- /dev/null +++ b/docker-entrypoint-dev.sh @@ -0,0 +1,24 @@ +#!/bin/bash -ex + +if [[ -f /var/www/html/index.php ]]; then + # Run the steps necessary to actually use the repository code. + cd /var/www/html + # This first command is also in the upstream entrypoint-script, but it needs to run before the PHP-scripts do, so we also need it here. + composer --prefer-dist --no-dev --no-interaction --optimize-autoloader install + # Download external Javascript dependencies. + bin/install-jsdeps.sh + # Minify all JS files + bin/jsshrink.sh + # Translate elastic's styles to CSS. + cd skins/elastic + npx lessc --clean-css="--s1 --advanced" styles/styles.less > styles/styles.min.css + npx lessc --clean-css="--s1 --advanced" styles/print.less > styles/print.min.css + npx lessc --clean-css="--s1 --advanced" styles/embed.less > styles/embed.min.css + cd - + # Update cache-buster parameters in CSS-URLs. + bin/updatecss.sh + # Minify all CSS files. + bin/cssshrink.sh +fi + +exec /docker-entrypoint.sh "$@"