diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..7a3f71f --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,33 @@ +name: Build docker image +on: + workflow_dispatch: + inputs: + IMAGE_NAME: + type: string + required: true + default: 'php-fpm-7.4-alpine' +permissions: + contents: read + packages: write +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + - name: Checkout source + uses: actions/checkout@v3 + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push Docker images + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + file: image/Dockerfile-${{ github.event.inputs.IMAGE_NAME }} + push: true + tags: ghcr.io/${{ github.repository }}:${{ github.event.inputs.IMAGE_NAME }} diff --git a/Makefile b/Makefile index 7e44052..1509446 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ duild: - cd image && IMAGE_NAME=php-fpm-7.1-alpine ../hooks/build + cd image && IMAGE_NAME=php-fpm-7.4-alpine ../hooks/build .PHONY: test test: test-static-analysis test-environment diff --git a/image/Dockerfile-php-fpm-7.4-alpine b/image/Dockerfile-php-fpm-7.4-alpine new file mode 100644 index 0000000..85ace75 --- /dev/null +++ b/image/Dockerfile-php-fpm-7.4-alpine @@ -0,0 +1,112 @@ +FROM php:7.4-fpm-alpine as builder + +RUN set -ex \ + + # Update + && apk add --update \ + + # Install build dependencies + && apk add --no-cache --virtual .build-tools \ + autoconf \ + make \ + gcc \ + g++ \ + + # Install dev dependencies + && apk add --no-cache --virtual .build-deps \ + zstd-dev \ + zlib-dev \ + libevent-dev \ + libmemcached-dev \ + + && pecl install igbinary \ + && pecl install \ + --configureoptions '\ + with-libmemcached-dir="/usr" \ + with-zlib-dir="/usr" \ + with-system-fastlz="no" \ + enable-memcached-igbinary="yes" \ + enable-memcached-msgpack="no" \ + enable-memcached-json="yes" \ + enable-memcached-protocol="no" \ + enable-memcached-sasl="yes" \ + enable-memcached-session="yes"\ + '\ + memcached \ + + && pecl install \ + --configureoptions '\ + enable-redis-igbinary="yes" \ + enable-redis-lzf="yes" \ + enable-redis-zstd="yes"\ + '\ + redis + +FROM php:7.4-fpm-alpine + +COPY --from=builder /usr/local/lib/php/extensions/no-debug-non-zts-20190902/* /usr/local/lib/php/extensions/no-debug-non-zts-20190902 +RUN set -ex \ + + # Update + && apk add --update \ + + # Install dependencies + && apk add --no-cache --virtual .deps \ + zlib \ + libzip \ + libpng \ + libjpeg-turbo \ + libwebp \ + freetype \ + libxslt \ + libmemcached \ + + # Install dev dependencies + && apk add --no-cache --virtual .build-deps \ + zlib-dev \ + libzip-dev \ + libpng-dev \ + libjpeg-turbo-dev \ + libwebp-dev \ + freetype-dev \ + libxslt-dev \ + + # Configure + && docker-php-ext-configure gd \ + --with-freetype \ + --with-jpeg \ + --with-webp \ + + # Build and install + && docker-php-ext-install -j$(nproc) \ + gd \ + zip \ + xsl \ + mysqli \ + pdo_mysql \ + + # Enable pecl-built extensions + && docker-php-ext-enable \ + igbinary \ + memcached \ + redis \ + + # Clean + && rm -rf /tmp/* \ + && apk del --purge .build-deps + +CMD ["php-fpm"] + +EXPOSE 9000 + +ARG BUILD_DATE +ARG VCS_REF + +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.vcs-url="https://github.com/Dockerware/docker-umi.cms.git" \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.schema-version="1.0" \ + org.label-schema.vendor="DockerWare" \ + org.label-schema.name="docker-umi.cms" \ + org.label-schema.description="Docker Community Image packaging for UMI.CMS" \ + org.label-schema.url="https://github.com/Dockerware/docker-umi.cms"