diff --git a/.github/workflows/build-apache2.yaml b/.github/workflows/build-apache2.yaml new file mode 100644 index 0000000..0e39ee4 --- /dev/null +++ b/.github/workflows/build-apache2.yaml @@ -0,0 +1,62 @@ +name: Build the Apache2 container + +on: + push: + branches: + - main + paths: + - apache2/** + schedule: + - cron: '0 7 * * *' + workflow_dispatch: + + +jobs: + build-push-apache2: + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + context: ./apache2 + platforms: linux/amd64,linux/arm64 + push: true + tags: | + ghcr.io/openconext/openconext-basecontainers/apache2:latest + ghcr.io/openconext/openconext-basecontainers/apache2:${{ github.sha }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + + - # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/.github/workflows/build-php82-apache2-node14-composer2.yaml b/.github/workflows/build-php82-apache2-node20-composer2.yaml similarity index 87% rename from .github/workflows/build-php82-apache2-node14-composer2.yaml rename to .github/workflows/build-php82-apache2-node20-composer2.yaml index 7b4e916..abd1a20 100644 --- a/.github/workflows/build-php82-apache2-node14-composer2.yaml +++ b/.github/workflows/build-php82-apache2-node20-composer2.yaml @@ -1,11 +1,11 @@ -name: Build the PHP 8.2 Apache2 Node14 Composer2 container +name: Build the PHP 8.2 Apache2 Node20 Composer2 container on: push: branches: - main paths: - - php82-apache2-node14-composer2/** + - php82-apache2-node20-composer2/** schedule: - cron: '0 7 * * *' @@ -42,12 +42,12 @@ jobs: - name: Build and push uses: docker/build-push-action@v4 with: - context: ./php82-apache2-node14-composer2 + context: ./php82-apache2-node20-composer2 platforms: linux/amd64,linux/arm64 push: true tags: | - ghcr.io/openconext/openconext-basecontainers/php82-apache2-node14-composer2:latest - ghcr.io/openconext/openconext-basecontainers/php82-apache2-node14-composer2:${{ github.sha }} + ghcr.io/openconext/openconext-basecontainers/php82-apache2-node20-composer2:latest + ghcr.io/openconext/openconext-basecontainers/php82-apache2-node20-composer2:${{ github.sha }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max diff --git a/README.md b/README.md index cf76985..e6c50a2 100644 --- a/README.md +++ b/README.md @@ -19,5 +19,5 @@ We provide the following base containers which can be used in downstream project ![Build status for php82 apache2 production image](https://github.com/OpenConext/OpenConext-BaseContainers/actions/workflows/build-php82-apache2.yaml/badge.svg) **Dev images:**
-![Build status for php72 apache2 node14 image](https://github.com/OpenConext/OpenConext-BaseContainers/actions/workflows/build-php82-apache2-node14-composer2.yaml/badge.svg)
-![Build status for php72 apache2 node16 image](https://github.com/OpenConext/OpenConext-BaseContainers/actions/workflows/build-php82-apache2-node16-composer2.yaml/badge.svg) +![Build status for php82 apache2 node16 image](https://github.com/OpenConext/OpenConext-BaseContainers/actions/workflows/build-php82-apache2-node16-composer2.yaml/badge.svg)
+![Build status for php82 apache2 node20 image](https://github.com/OpenConext/OpenConext-BaseContainers/actions/workflows/build-php82-apache2-node20-composer2.yaml/badge.svg) diff --git a/php82-apache2-node16-composer2/Dockerfile b/php82-apache2-node16-composer2/Dockerfile index 1703312..b054987 100644 --- a/php82-apache2-node16-composer2/Dockerfile +++ b/php82-apache2-node16-composer2/Dockerfile @@ -1,6 +1,7 @@ FROM ghcr.io/openconext/openconext-basecontainers/php82-apache2:latest COPY --from=composer:2 /usr/bin/composer /usr/bin/composer COPY --from=node:16-slim /usr/local/bin /usr/local/bin +COPY --from=node:16-slim /opt /opt COPY --from=node:16-slim /usr/local/lib/node_modules /usr/local/lib/node_modules SHELL ["/bin/bash", "--login", "-c"] RUN apt update && apt -y install git unzip diff --git a/php82-apache2-node14-composer2/Dockerfile b/php82-apache2-node20-composer2/Dockerfile similarity index 54% rename from php82-apache2-node14-composer2/Dockerfile rename to php82-apache2-node20-composer2/Dockerfile index 0288d86..cd08ebb 100644 --- a/php82-apache2-node14-composer2/Dockerfile +++ b/php82-apache2-node20-composer2/Dockerfile @@ -1,9 +1,10 @@ FROM ghcr.io/openconext/openconext-basecontainers/php82-apache2:latest COPY --from=composer:2 /usr/bin/composer /usr/bin/composer -SHELL ["/bin/bash", "--login", "-c"] +COPY --from=node:20-slim /usr/local/bin /usr/local/bin +COPY --from=node:20-slim /opt /opt +COPY --from=node:20-slim /usr/local/lib/node_modules /usr/local/lib/node_modules RUN apt update && apt -y install git unzip -RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash -RUN nvm install 14 -RUN npm install -g yarn RUN pecl install xdebug && docker-php-ext-enable xdebug COPY ./conf/xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +RUN apt autoremove -y && apt clean && apt autoclean && rm -rf /var/lib/apt/lists/* + diff --git a/php82-apache2-node14-composer2/conf/xdebug.ini b/php82-apache2-node20-composer2/conf/xdebug.ini similarity index 100% rename from php82-apache2-node14-composer2/conf/xdebug.ini rename to php82-apache2-node20-composer2/conf/xdebug.ini diff --git a/php82-apache2/Dockerfile b/php82-apache2/Dockerfile index 1a5ec8d..4b176c3 100644 --- a/php82-apache2/Dockerfile +++ b/php82-apache2/Dockerfile @@ -1,26 +1,35 @@ -FROM php:8.2.6-apache-bullseye - -# Copy the Composer PHAR from the Composer image into the PHP image -COPY --from=composer:1.9.3 /usr/bin/composer /usr/bin/composer -RUN chmod +x /usr/bin/composer +FROM php:8.2-apache-bullseye # Do an initial clean up and general upgrade of the distribution ENV DEBIAN_FRONTEND noninteractive RUN apt clean && apt autoclean && apt update -RUN apt -y upgrade && apt -y dist-upgrade # Install the packages we need RUN apt install -y curl \ + libpng16-16 \ + libjpeg62-turbo \ + libfreetype6 \ libgmp-dev \ - libicu-dev - -# Install the PHP extensions we need -RUN docker-php-ext-install gmp \ + libicu-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev &&\ + docker-php-ext-configure gd --with-freetype --with-jpeg &&\ + docker-php-ext-install -j$(nproc) gmp \ opcache \ - intl + intl \ + gd # Clean up -RUN apt autoremove -y && apt clean && apt autoclean && rm -rf /var/lib/apt/lists/* +RUN apt -y remove libgmp-dev \ + libicu-dev \ + libfreetype6-dev \ + libjpeg62-turbo-dev \ + libpng-dev && \ + apt autoremove -y && \ + apt clean && \ + apt autoclean && \ + rm -rf /var/lib/apt/lists/* # Enable the Apache2 modules we need RUN a2enmod rewrite headers expires proxy_fcgi