-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
push: | ||
paths: | ||
- build.sh | ||
- .github/workflows/build.yml | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
- arch: amd64 | ||
- arch: arm64 | ||
steps: | ||
- name: Clone | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Chisel | ||
uses: shyim/chisel-installer@main | ||
|
||
- name: Build image | ||
run: ./build.sh ${{ matrix.arch }} --push | ||
merge: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Login into Github Docker Registery | ||
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- run: docker manifest create friendsofshopware/code-style:latest --amend friendsofshopware/code-style-amd64 --amend friendsofshopware/code-style-arm64 | ||
|
||
- run: docker manifest push friendsofshopware/code-style:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
vendor | ||
.php-cs-fixer.cache | ||
/db | ||
/rootfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM --platform=$BUILDPLATFORM composer as download | ||
|
||
ADD . /cs-fix | ||
WORKDIR /cs-fix | ||
RUN composer install --no-dev --no-interaction --no-progress --no-suggest --optimize-autoloader | ||
RUN echo 'memory_limit = -1' > /php.ini | ||
|
||
FROM scratch | ||
|
||
LABEL org.opencontainers.image.authors="FriendsOfShopware" \ | ||
org.opencontainers.image.url="https://github.com/FriendsOfShopware/code-style" \ | ||
org.opencontainers.image.source="https://github.com/FriendsOfShopware/code-style" \ | ||
org.opencontainers.image.vendor="FriendsOfShopware" \ | ||
org.opencontainers.image.licenses="MIT" \ | ||
org.opencontainers.image.title="PHP-CS-Fixer" | ||
COPY rootfs/ / | ||
|
||
COPY --from=download /cs-fix /cs-fix | ||
COPY --from=download /php.ini /etc/php/8.2/cli/conf.d/99-memory-limit.ini | ||
ENTRYPOINT ["/usr/bin/php", "/cs-fix/bin/frosh-cs", "fix"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eo pipefail | ||
|
||
arch=$1 | ||
params=$2 | ||
|
||
if [ -z "$arch" ]; then | ||
echo "Usage: $0 <arch>" | ||
exit 1 | ||
fi | ||
|
||
echo "Building version $version" | ||
|
||
rm -rf rootfs | ||
mkdir rootfs | ||
|
||
if [[ ! -d db ]]; then | ||
git clone -b ubuntu-23.10-php https://github.com/shyim/chisel-releases.git db | ||
fi | ||
|
||
chisel cut --arch=$arch --release ./db --root rootfs/ php8.2-cli_base php8.2-common_all-cli php8.2-common_phar-cli php8.2-mbstring_cli php8.2-xml_dom-cli dash_bins | ||
|
||
docker build --platform "linux/${arch}" -t "friendsofshopware/code-style:${version}-${arch}" . | ||
|
||
if [[ "$params" == "--push" ]]; then | ||
docker push "friendsofshopware/code-style:${version}-${arch}" | ||
fi |