diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..0287c1c --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,35 @@ +# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-docker-hub + +name: Publish Docker Image + +on: + release: + types: [published] + +jobs: + push_to_registry: + name: Push Docker Image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Log in to Docker Hub + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: nicoverbruggen/php83-alpine + + - name: Build and push Docker Image + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..333cfae --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM php:8.3-alpine +# https://hub.docker.com/_/php/tags?page=1&name=8.3-alpine + +# Install PHP modules and clean up +RUN apk add --no-cache $PHPIZE_DEPS \ + imagemagick-dev icu-dev zlib-dev jpeg-dev libpng-dev libzip-dev libgomp linux-headers; \ + docker-php-ext-configure gd --with-jpeg; \ + docker-php-ext-install intl pcntl gd exif zip mysqli pgsql pdo pdo_mysql pdo_pgsql bcmath opcache; \ + pecl install xdebug; \ + docker-php-ext-enable xdebug; \ + echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini; \ + pecl install imagick; \ + docker-php-ext-enable imagick; \ + apk del $PHPIZE_DEPS; \ + rm -rf /tmp/pear; + +# Install other dependencies +RUN apk add --no-cache git curl sqlite nodejs npm nano \ No newline at end of file diff --git a/readme.md b/readme.md new file mode 100755 index 0000000..aed3c1d --- /dev/null +++ b/readme.md @@ -0,0 +1,27 @@ +# php83-alpine + +## What is this? + +This is a custom build based on PHP 8.3's Alpine docker image, with changes to make Laravel back-end testing easily possible. + +## Quick start + +In order to build and then test the container: + + docker buildx build . --platform linux/amd64 -t nicoverbruggen/php83-alpine \ + && docker run -it nicoverbruggen/php83-alpine sh + +You may omit the `--platform` flag if you wish to build a container for your own architecture, but there may be issues with dependencies. + +## Automatic builds + +The automatically build the container and have it pushed, you must: + +* Tag the commit you wish to build +* Create a new release with said tag + +The Docker action will automatically build the release and push it under that tag to Docker Hub. + +## Where can I find it? + +You can find the image on Docker Hub here: https://hub.docker.com/r/nicoverbruggen/php83-alpine. \ No newline at end of file