Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
marlonbaeten committed Apr 26, 2024
0 parents commit bd9e77d
Show file tree
Hide file tree
Showing 23 changed files with 1,148 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
17 changes: 17 additions & 0 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build and push

permissions:
contents: read
packages: write

on:
push:
branches:
- main
schedule:
- cron: '30 2 * * SUN'

jobs:
build-and-push:
uses: ./.github/workflows/docker.yml
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Checks

permissions:
contents: read

on:
pull_request:

jobs:
build:
uses: ./.github/workflows/docker.yml
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/container-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Container Registry Cleanup

permissions:
contents: read
packages: write

on:
workflow_dispatch:
schedule:
- cron: '30 2 * * MON'

jobs:
untagged-cleanup:
uses: "tweedegolf/actions-container-helpers/.github/workflows/container-untagged-cleanup.yml@main"
with:
package: php
54 changes: 54 additions & 0 deletions .github/workflows/docker-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Docker

on:
workflow_call:
inputs:
php_version:
type: string
latest:
type: boolean
composer_version:
type: string
debian_version:
type: string
postgresql_version:
type: string

jobs:
base:
uses: "tweedegolf/actions-container-helpers/.github/workflows/container-image.yml@main"
with:
context: "${{ inputs.php_version }}"
push: ${{ github.ref == 'refs/heads/main' }}
platforms: "linux/amd64,linux/arm64"
build-args: |
DEBIAN_VERSION=${{ inputs.debian_version }}
POSTGRESQL_VERSION=${{ inputs.postgresql_version }}
COMPOSER_VERSION=${{ inputs.composer_version }}
tags: |
ghcr.io/tweedegolf/php:${{inputs.php_version}}
${{ inputs.latest && 'ghcr.io/tweedegolf/php:latest' || '' }}
dev:
needs: [base]
uses: "tweedegolf/actions-container-helpers/.github/workflows/container-image.yml@main"
with:
context: "${{ inputs.php_version }}"
file: Dockerfile.dev
push: ${{ github.ref == 'refs/heads/main' }}
platforms: "linux/amd64,linux/arm64"
tags: |
ghcr.io/tweedegolf/php:${{inputs.php_version}}-dev
${{ inputs.latest && 'ghcr.io/tweedegolf/php:latest-dev' || '' }}
debug:
needs: [dev]
uses: "tweedegolf/actions-container-helpers/.github/workflows/container-image.yml@main"
with:
context: "${{ inputs.php_version }}"
file: Dockerfile.debug
push: ${{ github.ref == 'refs/heads/main' }}
platforms: "linux/amd64,linux/arm64"
tags: |
ghcr.io/tweedegolf/php:${{inputs.php_version}}-debug
${{ inputs.latest && 'ghcr.io/tweedegolf/php:latest-debug' || '' }}
21 changes: 21 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Docker

on:
workflow_call:

jobs:
build:
strategy:
matrix:
include:
- php_version: 8.3
latest: true
- php_version: 8.2
latest: false
uses: "./.github/workflows/docker-images.yml"
with:
php_version: ${{ matrix.php_version }}
latest: ${{ matrix.latest }}
debian_version: bookworm
postgresql_version: "16"
composer_version: "2.7.4"
46 changes: 46 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
stages:
- build

default:
tags: [ubuntu22.04]

before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- docker buildx create --use
- export DOCKER_BUILDKIT=1
- export POSTGRESQL_VERSION=15
- export COMPOSER_VERSION=2.6.5
- export NODE_VERSION=18

build:image:8.2:
stage: build
script:
- export PHP_VERSION=8.2
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile" --no-cache --pull --build-arg COMPOSER_VERSION --build-arg POSTGRESQL_VERSION -t "$CI_REGISTRY_IMAGE:$PHP_VERSION" -t "$CI_REGISTRY_IMAGE:8" -t "$CI_REGISTRY_IMAGE:latest"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.dev" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-dev" -t "$CI_REGISTRY_IMAGE:8-dev" -t "$CI_REGISTRY_IMAGE:latest-dev"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.debug" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-dev" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-debug" -t "$CI_REGISTRY_IMAGE:8-debug" -t "$CI_REGISTRY_IMAGE:latest-debug"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.fat" --no-cache --pull --build-arg NODE_VERSION --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat" -t "$CI_REGISTRY_IMAGE:8-fat" -t "$CI_REGISTRY_IMAGE:latest-fat"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.dev" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-fat" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-dev" -t "$CI_REGISTRY_IMAGE:8-fat-dev" -t "$CI_REGISTRY_IMAGE:latest-fat-dev"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.debug" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-dev" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-debug" -t "$CI_REGISTRY_IMAGE:8-fat-debug" -t "$CI_REGISTRY_IMAGE:latest-fat-debug"

build:image:8.1:
stage: build
script:
- export PHP_VERSION=8.1
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile" --no-cache --pull --build-arg COMPOSER_VERSION --build-arg POSTGRESQL_VERSION -t "$CI_REGISTRY_IMAGE:$PHP_VERSION"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.dev" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-dev"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.debug" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-dev" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-debug"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.fat" --no-cache --pull --build-arg NODE_VERSION --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.dev" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-fat" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-dev"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.debug" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-dev" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-debug"

build:image:8.0:
stage: build
script:
- export PHP_VERSION=8.0
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile" --no-cache --pull --build-arg COMPOSER_VERSION --build-arg POSTGRESQL_VERSION -t "$CI_REGISTRY_IMAGE:$PHP_VERSION"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.dev" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-dev"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.debug" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-dev" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-debug"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.fat" --no-cache --pull --build-arg NODE_VERSION --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.dev" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-fat" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-dev"
- docker buildx build --push --platform linux/amd64 "$PHP_VERSION/" -f "$PHP_VERSION/Dockerfile.debug" --no-cache --pull --build-arg "BASE_IMAGE=$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-dev" -t "$CI_REGISTRY_IMAGE:$PHP_VERSION-fat-debug"
60 changes: 60 additions & 0 deletions 8.2/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
ARG DEBIAN_VERSION
FROM ghcr.io/tweedegolf/debian:${DEBIAN_VERSION}

# Install postgresql client
ARG POSTGRESQL_VERSION
ENV POSTGRESQL_VERSION ${POSTGRESQL_VERSION}
RUN curl -s -L https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
&& echo "deb http://apt.postgresql.org/pub/repos/apt/ bookworm-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
postgresql-client-$POSTGRESQL_VERSION \
&& rm -rf /var/lib/apt/lists/*

# Install the custom PHP repository
ENV PHP_VERSION 8.2
RUN curl -s -L https://packages.sury.org/php/apt.gpg | apt-key add - \
&& echo "deb https://packages.sury.org/php/ bookworm main" > /etc/apt/sources.list.d/sury_php.list \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
php${PHP_VERSION}-bcmath \
php${PHP_VERSION}-cli \
php${PHP_VERSION}-common \
php${PHP_VERSION}-curl \
php${PHP_VERSION}-dev \
php${PHP_VERSION}-enchant \
php${PHP_VERSION}-fpm \
php${PHP_VERSION}-gd \
php${PHP_VERSION}-gmp \
php${PHP_VERSION}-intl \
php${PHP_VERSION}-mbstring \
php${PHP_VERSION}-mysql \
php${PHP_VERSION}-odbc \
php${PHP_VERSION}-opcache \
php${PHP_VERSION}-pgsql \
php${PHP_VERSION}-soap \
php${PHP_VERSION}-sqlite3 \
php${PHP_VERSION}-tidy \
php${PHP_VERSION}-xml \
php${PHP_VERSION}-xsl \
php${PHP_VERSION}-zip \
php${PHP_VERSION}-apcu \
php${PHP_VERSION}-ast \
php${PHP_VERSION}-imagick \
php${PHP_VERSION}-memcache \
php${PHP_VERSION}-memcached \
php${PHP_VERSION}-redis \
php-pear \
&& rm -rf /var/lib/apt/lists/*
COPY php-fpm.conf /etc/php/${PHP_VERSION}/fpm/php-fpm.conf
COPY php.ini /etc/php/${PHP_VERSION}/fpm/php.ini
COPY php.ini /etc/php/${PHP_VERSION}/cli/php.ini

# Install composer
ARG COMPOSER_VERSION
ENV COMPOSER_VERSION ${COMPOSER_VERSION}
RUN curl -L -s -o /usr/local/bin/composer https://getcomposer.org/download/$COMPOSER_VERSION/composer.phar \
&& chmod a+x /usr/local/bin/composer

CMD [ "/usr/sbin/php-fpm8.2" ]
EXPOSE 9000
9 changes: 9 additions & 0 deletions 8.2/Dockerfile.debug
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM ghcr.io/tweedegolf/php:8.2-dev

ENV PHP_VERSION 8.2
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
php${PHP_VERSION}-xdebug \
&& rm -rf /var/lib/apt/lists/*

COPY xdebug.ini /etc/php/${PHP_VERSION}/mods-available/xdebug.ini
4 changes: 4 additions & 0 deletions 8.2/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM ghcr.io/tweedegolf/php:8.2

COPY php-dev.ini /etc/php/${PHP_VERSION}/fpm/php.ini
COPY php-dev.ini /etc/php/${PHP_VERSION}/cli/php.ini
Loading

0 comments on commit bd9e77d

Please sign in to comment.