Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Docker Hub with GitHub Container Registry #298

Merged
merged 6 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Docker
on: [workflow_dispatch, push]
flavioheleno marked this conversation as resolved.
Show resolved Hide resolved

jobs:
docker:
name: PHP v${{ matrix.php.major }}.${{ matrix.php.minor }}, ${{ matrix.flags.name }}
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
matrix:
ubuntu:
- major: '22'
minor: '04'
php:
- major: 8
minor: 0
patch: 24
rc: ''
- major: 8
minor: 1
patch: 11
rc: ''
- major: 8
minor: 2
patch: 0
rc: ''
- major: 8
minor: 3
patch: 7
rc: ''
src:
- dist
flags:
- name: asan
debug: disable
asan: enable
gcov: disable
- name: dbg
debug: enable
asan: disable
gcov: disable
- name: gcov
debug: disable
asan: disable
gcov: enable
- name: release
debug: disable
asan: disable
gcov: disable
exclude:
- php: {major: 8, minor: 0}
flags: {name: asan}

steps:
- name: Prepare build variables
id: build-vars
run: echo "tag=ghcr.io/${{ github.repository_owner }}/php-${{ matrix.flags.name }}-${{ matrix.php.major }}.${{ matrix.php.minor }}:latest" >> $GITHUB_OUTPUT

- name: Repository checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0

- name: Login to GitHub Container Registry
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# https://docs.docker.com/build/ci/github-actions/cache/
- name: Build and export Docker Image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
load: true
build-args: |
"UBUNTU_VERSION_MAJOR=${{ matrix.ubuntu.major }}"
"UBUNTU_VERSION_MINOR=${{ matrix.ubuntu.minor }}"
"PHP_SRC_TYPE=${{ matrix.src }}"
"PHP_SRC_DEBUG=${{ matrix.flags.debug }}"
"PHP_SRC_ASAN=${{ matrix.flags.asan }}"
"PHP_SRC_GCOV=${{ matrix.flags.gcov }}"
"PHP_VERSION_MAJOR=${{ matrix.php.major }}"
"PHP_VERSION_MINOR=${{ matrix.php.minor }}"
"PHP_VERSION_PATCH=${{ matrix.php.patch }}"
"PHP_VERSION_RC=${{ matrix.php.rc }}"
tags: ${{ steps.build-vars.outputs.tag }}
file: ./docker/php.dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max

# https://docs.docker.com/build/ci/github-actions/test-before-push/
- name: Test Docker Image
run: docker run --rm ${{ steps.build-vars.outputs.tag }} php --version

- name: Build and push Docker Image
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
push: true
build-args: |
"UBUNTU_VERSION_MAJOR=${{ matrix.ubuntu.major }}"
"UBUNTU_VERSION_MINOR=${{ matrix.ubuntu.minor }}"
"PHP_SRC_TYPE=${{ matrix.src }}"
"PHP_SRC_DEBUG=${{ matrix.flags.debug }}"
"PHP_SRC_ASAN=${{ matrix.flags.asan }}"
"PHP_SRC_GCOV=${{ matrix.flags.gcov }}"
"PHP_VERSION_MAJOR=${{ matrix.php.major }}"
"PHP_VERSION_MINOR=${{ matrix.php.minor }}"
"PHP_VERSION_PATCH=${{ matrix.php.patch }}"
"PHP_VERSION_RC=${{ matrix.php.rc }}"
tags: |
${{ steps.build-vars.outputs.tag }}
ghcr.io/${{ github.repository_owner }}/php-${{ matrix.flags.name }}-${{ matrix.php.major }}.${{ matrix.php.minor }}:${{ matrix.php.major }}.${{ matrix.php.minor }}.${{ matrix.php.patch }}${{ matrix.php.rc }}
file: ./docker/php.dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
52 changes: 22 additions & 30 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
}
},
container_name: php-dbg-8.0,
image: parallelphp/php-dbg-8.0:8.0.24,
image: ghcr.io/krakjoe/php-dbg-8.0:8.0.24,
profiles: [php-8.0,dbg],
<<: [*dev, *parallel]
}
Expand All @@ -55,7 +55,7 @@ services:
}
},
container_name: php-gcov-8.0,
image: parallelphp/php-gcov-8.0:8.0.24,
image: ghcr.io/krakjoe/php-gcov-8.0:8.0.24,
profiles: [php-8.0,gcov],
<<: [*dev, *parallel]
}
Expand All @@ -70,7 +70,7 @@ services:
}
},
container_name: php-release-8.0,
image: parallelphp/php-release-8.0:8.0.24,
image: ghcr.io/krakjoe/php-release-8.0:8.0.24,
profiles: [php-8.0,release],
<<: [*dev, *parallel]
}
Expand All @@ -87,7 +87,7 @@ services:
}
},
container_name: parallel-dbg-8.0,
image: parallelphp/parallel-dbg-8.0:latest,
image: ghcr.io/krakjoe/parallel-dbg-8.0:latest,
profiles: [parallel-8.0,dbg],
<<: [*dev, *parallel]
}
Expand All @@ -103,7 +103,7 @@ services:
}
},
container_name: parallel-gcov-8.0,
image: parallelphp/parallel-gcov-8.0:latest,
image: ghcr.io/krakjoe/parallel-gcov-8.0:latest,
profiles: [parallel-8.0,gcov],
<<: [*dev, *parallel]
}
Expand All @@ -119,7 +119,7 @@ services:
}
},
container_name: parallel-release-8.0,
image: parallelphp/parallel-release-8.0:latest,
image: ghcr.io/krakjoe/parallel-release-8.0:latest,
profiles: [parallel-8.0,release],
<<: [*dev, *parallel]
}
Expand All @@ -135,7 +135,7 @@ services:
}
},
container_name: php-dbg-8.1,
image: parallelphp/php-dbg-8.1:8.1.11,
image: ghcr.io/krakjoe/php-dbg-8.1:8.1.11,
profiles: [php-8.1,dbg],
<<: [*dev, *parallel]
}
Expand All @@ -150,7 +150,7 @@ services:
}
},
container_name: php-gcov-8.1,
image: parallelphp/php-gcov-8.1:8.1.11,
image: ghcr.io/krakjoe/php-gcov-8.1:8.1.11,
profiles: [php-8.1,gcov],
<<: [*dev, *parallel]
}
Expand All @@ -165,7 +165,7 @@ services:
}
},
container_name: php-asan-8.1,
image: parallelphp/php-asan-8.1:8.1.11,
image: ghcr.io/krakjoe/php-asan-8.1:8.1.11,
profiles: [php-8.1,asan],
<<: [*dev, *parallel]
}
Expand All @@ -180,7 +180,7 @@ services:
}
},
container_name: php-release-8.1,
image: parallelphp/php-release-8.1:8.1.11,
image: ghcr.io/krakjoe/php-release-8.1:8.1.11,
profiles: [php-8.1,release],
<<: [*dev, *parallel]
}
Expand All @@ -196,7 +196,7 @@ services:
}
},
container_name: parallel-dbg-8.1,
image: parallelphp/parallel-dbg-8.1:latest,
image: ghcr.io/krakjoe/parallel-dbg-8.1:latest,
profiles: [parallel-8.1,dbg],
<<: [*dev, *parallel]
}
Expand All @@ -212,7 +212,7 @@ services:
}
},
container_name: parallel-gcov-8.1,
image: parallelphp/parallel-gcov-8.1:latest,
image: ghcr.io/krakjoe/parallel-gcov-8.1:latest,
profiles: [parallel-8.1,gcov],
<<: [*dev, *parallel]
}
Expand All @@ -227,7 +227,7 @@ services:
}
},
container_name: parallel-asan-8.1,
image: parallelphp/parallel-asan-8.1:latest,
image: ghcr.io/krakjoe/parallel-asan-8.1:latest,
profiles: [parallel-8.1,asan],
<<: [*dev, *parallel]
}
Expand All @@ -242,7 +242,7 @@ services:
}
},
container_name: parallel-release-8.1,
image: parallelphp/parallel-release-8.1:latest,
image: ghcr.io/krakjoe/parallel-release-8.1:latest,
profiles: [parallel-8.1,release],
<<: [*dev, *parallel]
}
Expand All @@ -256,11 +256,10 @@ services:
PHP_VERSION_MAJOR: 8,
PHP_VERSION_MINOR: 2,
PHP_VERSION_PATCH: 0,
PHP_VERSION_RC: RC5,
}
},
container_name: php-dbg-8.2,
image: parallelphp/php-dbg-8.2:8.2.0RC5,
image: ghcr.io/krakjoe/php-dbg-8.2:8.2.0,
profiles: [php-8.2,dbg],
<<: [*dev, *parallel]
}
Expand All @@ -273,11 +272,10 @@ services:
PHP_VERSION_MAJOR: 8,
PHP_VERSION_MINOR: 2,
PHP_VERSION_PATCH: 0,
PHP_VERSION_RC: RC5,
}
},
container_name: php-gcov-8.2,
image: parallelphp/php-gcov-8.2:8.2.0RC5,
image: ghcr.io/krakjoe/php-gcov-8.2:8.2.0,
profiles: [php-8.2,gcov],
<<: [*dev, *parallel]
}
Expand All @@ -290,11 +288,10 @@ services:
PHP_VERSION_MAJOR: 8,
PHP_VERSION_MINOR: 2,
PHP_VERSION_PATCH: 0,
PHP_VERSION_RC: RC5,
}
},
container_name: php-asan-8.2,
image: parallelphp/php-asan-8.2:8.2.0RC5,
image: ghcr.io/krakjoe/php-asan-8.2:8.2.0,
profiles: [php-8.2,asan],
<<: [*dev, *parallel]
}
Expand All @@ -307,11 +304,10 @@ services:
PHP_VERSION_MAJOR: 8,
PHP_VERSION_MINOR: 2,
PHP_VERSION_PATCH: 0,
PHP_VERSION_RC: RC5,
}
},
container_name: php-release-8.2,
image: parallelphp/php-release-8.2:8.2.0RC5,
image: ghcr.io/krakjoe/php-release-8.2:8.2.0,
profiles: [php-8.2,release],
<<: [*dev, *parallel]
}
Expand All @@ -324,11 +320,10 @@ services:
PHP_VERSION_MAJOR: 8,
PHP_VERSION_MINOR: 2,
PHP_VERSION_PATCH: 0,
PHP_VERSION_RC: RC5,
}
},
container_name: parallel-dbg-8.2,
image: parallelphp/parallel-dbg-8.2:latest,
image: ghcr.io/krakjoe/parallel-dbg-8.2:latest,
profiles: [parallel-8.2,dbg],
<<: [*dev, *parallel]
}
Expand All @@ -341,11 +336,10 @@ services:
PHP_VERSION_MAJOR: 8,
PHP_VERSION_MINOR: 2,
PHP_VERSION_PATCH: 0,
PHP_VERSION_RC: RC5,
}
},
container_name: parallel-gcov-8.2,
image: parallelphp/parallel-gcov-8.2:latest,
image: ghcr.io/krakjoe/parallel-gcov-8.2:latest,
profiles: [parallel-8.2,gcov],
<<: [*dev, *parallel]
}
Expand All @@ -358,11 +352,10 @@ services:
PHP_VERSION_MAJOR: 8,
PHP_VERSION_MINOR: 2,
PHP_VERSION_PATCH: 0,
PHP_VERSION_RC: RC5,
}
},
container_name: parallel-asan-8.2,
image: parallelphp/parallel-asan-8.2:latest,
image: ghcr.io/krakjoe/parallel-asan-8.2:latest,
profiles: [parallel-8.2,asan],
<<: [*dev, *parallel]
}
Expand All @@ -375,11 +368,10 @@ services:
PHP_VERSION_MAJOR: 8,
PHP_VERSION_MINOR: 2,
PHP_VERSION_PATCH: 0,
PHP_VERSION_RC: RC5,
}
},
container_name: parallel-release-8.2,
image: parallelphp/parallel-release-8.2:latest,
image: ghcr.io/krakjoe/parallel-release-8.2:latest,
profiles: [parallel-8.2,release],
<<: [*dev, *parallel]
}
4 changes: 2 additions & 2 deletions docker/parallel.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG PHP_VERSION_MINOR
ARG PHP_VERSION_PATCH
ARG PHP_VERSION_RC

FROM parallelphp/php-$PHP_SRC_TYPE-$PHP_VERSION_MAJOR.$PHP_VERSION_MINOR:$PHP_VERSION_MAJOR.$PHP_VERSION_MINOR.$PHP_VERSION_PATCH$PHP_VERSION_RC
FROM ghcr.io/krakjoe/php-$PHP_SRC_TYPE-$PHP_VERSION_MAJOR.$PHP_VERSION_MINOR:$PHP_VERSION_MAJOR.$PHP_VERSION_MINOR.$PHP_VERSION_PATCH$PHP_VERSION_RC

ARG PHP_SRC_TYPE

Expand Down Expand Up @@ -38,4 +38,4 @@ RUN echo "extension=parallel.so" > \

RUN php -m

WORKDIR /opt/parallel
WORKDIR /opt/parallel
Loading