From 0eb40826adda75fbc05d9860d6fb04dc2449ece2 Mon Sep 17 00:00:00 2001 From: Gertjan Krol Date: Sun, 28 May 2023 21:22:57 +0200 Subject: [PATCH] Initial commit - PHP 8.2 image --- .forgejo/workflows/release.yaml | 22 ++++++++++++++++++++++ .forgejo/workflows/test-build.yaml | 21 +++++++++++++++++++++ Dockerfile | 7 +++++++ Dockerfile-fpm | 7 +++++++ README.md | 2 ++ 5 files changed, 59 insertions(+) create mode 100644 .forgejo/workflows/release.yaml create mode 100644 .forgejo/workflows/test-build.yaml create mode 100644 Dockerfile create mode 100644 Dockerfile-fpm create mode 100644 README.md diff --git a/.forgejo/workflows/release.yaml b/.forgejo/workflows/release.yaml new file mode 100644 index 0000000..8ededc6 --- /dev/null +++ b/.forgejo/workflows/release.yaml @@ -0,0 +1,22 @@ +name: Release +on: + push: + tags: + - '*' + +jobs: + build_push: + runs-on: ubuntu-latest + container: git.gertjankrol.nl/docker/toolkit:latest + env: + REGISTRY: git.gertjankrol.nl + IMAGE_NAMESPACE: docker/php + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Docker login + run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} https://${REGISTRY} + - name: Build and push containers + run: | + docker build . -t ${REGISTRY}/${IMAGE_NAMESPACE}:${{ github.ref_name }} --push + docker build . -f Dockerfile-fpm -t ${REGISTRY}/${IMAGE_NAMESPACE}:${{ github.ref_name }}-fpm --push diff --git a/.forgejo/workflows/test-build.yaml b/.forgejo/workflows/test-build.yaml new file mode 100644 index 0000000..90b0c91 --- /dev/null +++ b/.forgejo/workflows/test-build.yaml @@ -0,0 +1,21 @@ +name: Test +on: + push: + branches: + - '*' + +jobs: + test_build: + runs-on: ubuntu-latest + container: git.gertjankrol.nl/docker/toolkit:latest + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Build containers + run: | + docker build . -t php-test:${{ github.ref_name }} + docker build . -f Dockerfile-fpm -t php-test:${{ github.ref_name }}-fpm + - name: Default image details + run: docker image inspect php-test:${{ github.ref_name }} + - name: FPM image details + run: docker image inspect php-test:${{ github.ref_name }}-fpm diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f8dc504 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM php:8.2-alpine AS php-system-setup +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +COPY --from=mlocati/php-extension-installer:2 /usr/bin/install-php-extensions /usr/bin/ +RUN install-php-extensions bcmath curl mbstring fileinfo gd intl mysqli opcache openssl pcntl pdo_mysql posix redis uuid zip + +COPY --from=composer/composer:2 /usr/bin/composer /usr/local/bin/ diff --git a/Dockerfile-fpm b/Dockerfile-fpm new file mode 100644 index 0000000..c600c81 --- /dev/null +++ b/Dockerfile-fpm @@ -0,0 +1,7 @@ +FROM php:8.2-fpm-alpine AS php-system-setup +RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" + +COPY --from=mlocati/php-extension-installer:2 /usr/bin/install-php-extensions /usr/bin/ +RUN install-php-extensions bcmath curl mbstring fileinfo gd intl mysqli opcache openssl pcntl pdo_mysql posix redis uuid zip + +COPY --from=composer/composer:2 /usr/bin/composer /usr/local/bin/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..51e6b41 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +## PHP Docker image +> Includes Composer and some common extensions