diff --git a/.github/workflows/postgres.yml b/.github/workflows/postgres.yml new file mode 100644 index 0000000..ac4c8a7 --- /dev/null +++ b/.github/workflows/postgres.yml @@ -0,0 +1,62 @@ +name: Docker Image PostgreSQL +on: + workflow_dispatch: + schedule: + - cron: "0 6 * * *" # 6 AM Daily + push: + paths: + - postgres/** + - .github/workflows/postgres.yml + +jobs: + postgres: + name: PostgreSQL + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + version: + - "16" + - "15" + - "14" + - "13" + - "12" + + steps: + - uses: actions/checkout@v3 + - uses: docker/setup-qemu-action@v2 + - uses: docker/setup-buildx-action@v2 + + - name: Login to Github Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + if: ${{ !env.ACT }} + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + if: ${{ !env.ACT }} + + - name: Set build-args + run: |- + ESCAPED_VERSION="$(echo ${{ matrix.version }} | sed 's/\./\\\./g')" + POSTGRES_VERSION=$( + docker run --rm gcr.io/go-containerregistry/crane:v0.8.0 ls postgres \ + | egrep "^${ESCAPED_VERSION}(\.[0-9]+)?(-alpine)?\$" | sort -Vr | head -n1 + ) + echo "POSTGRES_VERSION=${POSTGRES_VERSION}" | tee /dev/stderr >> $GITHUB_ENV + + - uses: docker/build-push-action@v3 + with: + context: postgres + platforms: linux/amd64,linux/arm64 + build-args: POSTGRES_VERSION=${{ env.POSTGRES_VERSION }} + push: ${{ github.ref == 'refs/heads/main' && !env.ACT }} + tags: ghcr.io/${{ github.repository_owner }}/postgres:${{ matrix.version }},wardenenv/postgres:${{matrix.version}} + diff --git a/php/cli/Dockerfile b/php/cli/Dockerfile index 13cc7f8..948cb04 100644 --- a/php/cli/Dockerfile +++ b/php/cli/Dockerfile @@ -2,7 +2,7 @@ FROM quay.io/centos/centos:stream9 ARG PHP_VERSION ARG PHP_EXTENSIONS="bcmath cli common gd gmp intl json mbstring \ - mcrypt sodium mysqlnd opcache pdo pecl-msgpack pecl-amqp pecl-redis pecl-imagick pecl-zip process soap xml xmlrpc" + mcrypt sodium mysqlnd pgsql opcache pdo pdo_pgdql pecl-msgpack pecl-amqp pecl-redis pecl-imagick pecl-zip process soap xml xmlrpc" RUN dnf update -y \ && dnf clean all \ diff --git a/postgres/Dockerfile b/postgres/Dockerfile new file mode 100644 index 0000000..ecc1225 --- /dev/null +++ b/postgres/Dockerfile @@ -0,0 +1,5 @@ +ARG POSTGRES_VERSION +FROM pgsql:${POSTGRES_VERSION} + +COPY docker-entrypoint-initdb.d/uuid-ossp-extension.sql /docker-entrypoint-init.d/uuid-ossp-extension.sql + diff --git a/postgres/docker-entrypoint-initdb.d/uuid-ossp-extension.sql b/postgres/docker-entrypoint-initdb.d/uuid-ossp-extension.sql new file mode 100644 index 0000000..c941cb3 --- /dev/null +++ b/postgres/docker-entrypoint-initdb.d/uuid-ossp-extension.sql @@ -0,0 +1 @@ +CREATE EXTENSION "uuid-ossp";