diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 8746a90..1742e2c 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -3,24 +3,23 @@ name: Docker Image CI on: workflow_dispatch: schedule: - - cron: '15 * 1,15 * *' # Runs only on default branch + - cron: "15 * 1,15 * *" # Runs only on default branch push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] jobs: - build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Publish to Registry - uses: elgohr/Publish-Docker-Github-Action@v5 - with: - name: ivuorinen/docker-php-with-imagick - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - default_branch: main - tags: "latest,php74" - cache: ${{ github.event_name != 'schedule' }} + - uses: actions/checkout@v4 + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v5 + with: + name: ivuorinen/docker-php-with-imagick + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + default_branch: main + tags: "latest,php74" + cache: ${{ github.event_name != 'schedule' }} diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index a38ad6e..a106ee7 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -7,13 +7,13 @@ name: GitHub Docker Registry Build on: schedule: - - cron: '41 1 * * *' + - cron: "41 1 * * *" push: - branches: [ "main" ] + branches: ["main"] # Publish semver tags as releases. - tags: [ 'v*.*.*' ] + tags: ["v*.*.*"] pull_request: - branches: [ "main" ] + branches: ["main"] env: # Use docker.io for Docker Hub if empty @@ -21,10 +21,8 @@ env: # github.repository as / IMAGE_NAME: ${{ github.repository }} - jobs: build: - runs-on: ubuntu-latest permissions: contents: read @@ -43,8 +41,7 @@ jobs: if: github.event_name != 'pull_request' uses: sigstore/cosign-installer@main with: - cosign-release: 'v1.13.1' - + cosign-release: "v1.13.1" # Workaround: https://github.com/docker/build-push-action/issues/461 - name: Setup Docker buildx diff --git a/Dockerfile b/Dockerfile index 30cdf19..9e3addb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,22 @@ FROM php:7.4 -RUN echo "" \ - && docker-php-ext-install bcmath \ - && docker-php-ext-configure pcntl \ - && docker-php-ext-install pcntl \ - && apt-get update \ - && apt-get install -y \ - libicu-dev libxml2-dev libfreetype6-dev libjpeg62-turbo-dev \ - libpng-dev libonig-dev libmagickwand-dev python-dev unzip \ - && apt-get clean \ - && rm -rf /var/lib/apt/lists/* \ - && docker-php-ext-configure gd --with-freetype --with-jpeg \ - && docker-php-ext-install -j$(nproc) intl mbstring pdo xml gd exif bcmath \ - && yes '' | pecl install imagick \ - && docker-php-ext-enable imagick \ - && curl -sS https://getcomposer.org/installer \ - | php -- --install-dir=/usr/local/bin --filename=composer -RUN php --version \ - && composer --version +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +RUN echo "" \ + && docker-php-ext-install bcmath \ + && docker-php-ext-configure pcntl \ + && docker-php-ext-install pcntl \ + && apt-get update \ + && apt-get install -y \ + libicu-dev libxml2-dev libfreetype6-dev libjpeg62-turbo-dev \ + libpng-dev libonig-dev libmagickwand-dev python-dev unzip \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) intl mbstring pdo xml gd exif bcmath \ + && pecl install imagick && docker-php-ext-enable imagick \ + && curl -sS https://getcomposer.org/installer \ + | php -- --install-dir=/usr/local/bin --filename=composer +RUN php --version \ + && composer --version diff --git a/README.md b/README.md index 23dc389..b75fab9 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,20 @@ # docker-php-with-imagick + PHP 7.4 with imagick for specific purposes + +## Building locally + +### Setup docker buildx (run once) + +```bash +docker run --privileged --rm tonistiigi/binfmt --install all +docker buildx create --use +``` + +### Build the image + +```bash +docker buildx build --platform linux/amd64,linux/arm64 . +``` + +Example builds for both amd64 and arm64