Skip to content

Commit 39ea03f

Browse files
committed
Remove no more required file and clean configurations
1 parent ead9fce commit 39ea03f

File tree

6 files changed

+48
-225
lines changed

6 files changed

+48
-225
lines changed

.github/workflows/sylius-frankenphp.yml

Lines changed: 40 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@ name: PHP Docker Image CI for Sylius
33
on:
44
workflow_dispatch: ~
55
push:
6-
branches:
7-
- frankenphp
6+
branches: [ frankenphp ]
7+
paths:
8+
- 'frankenphp/**'
9+
- 'WORKSPACE'
10+
schedule:
11+
- cron: '0 20 * * 5'
12+
13+
concurrency:
14+
group: sylius_frankenphp_build
15+
cancel-in-progress: false
816

917
jobs:
1018

@@ -66,15 +74,14 @@ jobs:
6674
password: ${{ secrets.GITHUB_TOKEN }}
6775
logout: true
6876

69-
- name: Build and push
70-
uses: docker/build-push-action@v5.0.0
77+
- name: Build multiplatform
78+
uses: docker/build-push-action@v5
7179
with:
7280
file: ./frankenphp/Dockerfile
7381
context: ./frankenphp
74-
build-args: |
75-
"FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
82+
build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
7683
platforms: linux/amd64,linux/arm64
77-
push: ${{ github.ref == 'refs/heads/frankenphp' || github.event_name == 'workflow_dispatch' }}
84+
push: false
7885
pull: true
7986
tags: ${{ steps.meta.outputs.tags }}
8087
cache-from: type=local,src=/tmp/.buildx-cache
@@ -108,107 +115,42 @@ jobs:
108115
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new-arm64
109116
outputs: type=docker,dest=./external/image-arm64.tar
110117

111-
# - name: Mount Bazel cache
112-
# uses: actions/cache@v4
113-
# with:
114-
# path: "~/.cache/bazel"
115-
# key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}"
116-
# restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-"
117-
118-
# - name: Setup PHP for Bazel
119-
# run: |
120-
# set -ex
121-
# cat > frankenphp/php-version.bzl <<EOF
122-
# PHP_VERSION = "${{ matrix.php }}"
123-
# EOF
124-
# cat > frankenphp/frankenphp-arch.bzl <<EOF
125-
# ARCHITECTURES = ["amd64", "arm64"]
126-
# EOF
127-
128-
# - name: Bazel build and test
129-
# run: |
130-
# set -ex
131-
# targets=$(bazel query 'attr(visibility, "//visibility:public", //frankenphp:*)' | sort)
132-
# bazel build --curses=no ${targets}
133-
# bazel test --curses=no --test_output=errors ${targets}
134-
135-
- name: Move cache
136-
run: |
137-
rm -rf /tmp/.buildx-cache
138-
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
139-
140-
build-xdebug:
141-
needs: build
142-
143-
name: "Sylius PHP with Xdebug - ${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
144-
145-
runs-on: ubuntu-latest
146-
147-
strategy:
148-
fail-fast: false
149-
matrix:
150-
frankenphp: [ "1.5-php" ]
151-
php: [ "8.0", "8.1", "8.2", "8.3", "8.4" ]
152-
distro: [ "", "-alpine" ]
153-
154-
steps:
155-
156-
- uses: actions/checkout@v4
157-
158-
- name: Generate UUID
159-
id: generate-uuid
160-
run: |
161-
UUID=$(cat /proc/sys/kernel/random/uuid)
162-
echo "UUID=${UUID}" >> $GITHUB_OUTPUT
163-
164-
- name: Set up QEMU
165-
id: qemu
166-
uses: docker/setup-qemu-action@v3
167-
168-
- name: Available platforms
169-
run: echo ${{ steps.qemu.outputs.platforms }}
170-
171-
- name: Docker meta
172-
id: meta
173-
uses: docker/metadata-action@v5
174-
with:
175-
images: ${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }}
176-
tags: |
177-
type=raw,value=${{ matrix.frankenphp }}${{ matrix.php }}-xdebug-${{ matrix.distro }}
178-
179-
- name: Set up Docker Buildx
180-
uses: docker/setup-buildx-action@v3
181-
182-
- name: Cache Docker layers
118+
- name: Mount Bazel cache
183119
uses: actions/cache@v4
184120
with:
185-
path: /tmp/.buildx-cache
186-
key: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}"
187-
# https://github.com/actions/cache/issues/109#issuecomment-558771281
188-
# https://github.community/t/always-save-new-cache-for-incremental-builds/172791
189-
restore-keys: "${{ runner.os }}-frankenphp-xdebug-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-buildx-cache-${{ vars.CACHE_VERSION }}-"
121+
path: "~/.cache/bazel"
122+
key: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-${{ steps.generate-uuid.outputs.uuid }}"
123+
restore-keys: "${{ runner.os }}-frankenphp-${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}-bazel-cache-${{ vars.CACHE_VERSION }}-"
190124

191-
- name: Docker Login
192-
uses: docker/login-action@v3
193-
with:
194-
registry: ghcr.io
195-
username: ${{ github.actor }}
196-
password: ${{ secrets.GITHUB_TOKEN }}
197-
logout: true
125+
- name: Setup PHP for Bazel
126+
run: |
127+
set -ex
128+
cat > frankenphp/php-version.bzl <<EOF
129+
PHP_VERSION = "${{ matrix.php }}"
130+
EOF
131+
cat > frankenphp/frankenphp-arch.bzl <<EOF
132+
ARCHITECTURES = ["amd64", "arm64"]
133+
EOF
134+
135+
- name: Bazel build and test
136+
run: |
137+
set -ex
138+
targets=$(bazel query 'attr(visibility, "//visibility:public", //frankenphp:*)' | sort)
139+
bazel build --curses=no ${targets}
140+
bazel test --curses=no --test_output=errors ${targets}
198141
199-
- name: Build and push
142+
- name: Push
200143
uses: docker/build-push-action@v5
201144
with:
202-
file: ./frankenphp/xdebug.Dockerfile
145+
file: ./frankenphp/Dockerfile
203146
context: ./frankenphp
204-
build-args: |
205-
"IMAGE_NAME=${{ vars.DOCKER_FRANKENPHP_REPOSITORY_NAME }}"
206-
"IMAGE_TAG=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
147+
build-args: "FRANKENPHP_VERSION=${{ matrix.frankenphp }}${{ matrix.php }}-${{ matrix.distro }}"
207148
platforms: linux/amd64,linux/arm64
208149
push: ${{ github.ref == 'refs/heads/frankenphp' || github.ref == 'refs/heads/main' || github.event_name == 'release' }}
209-
pull: true
150+
pull: false
210151
tags: ${{ steps.meta.outputs.tags }}
211-
cache-from: type=local,src=/tmp/.buildx-cache
152+
labels: ${{ steps.meta.outputs.labels }}
153+
cache-from: type=local,src=/tmp/.buildx-cache-new
212154
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
213155

214156
- name: Move cache

frankenphp/Caddyfile

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,9 @@
99
{$CADDY_EXTRA_CONFIG}
1010

1111
{$SERVER_NAME:localhost} {
12-
log {
13-
# Redact the authorization query parameter that can be set by Mercure
14-
format filter {
15-
request>uri query {
16-
replace authorization REDACTED
17-
}
18-
}
19-
}
2012

2113
root * /srv/sylius/public
2214
encode zstd br gzip
2315

24-
mercure {
25-
# Transport to use (default to Bolt)
26-
transport_url {$MERCURE_TRANSPORT_URL:bolt:///frankenphp-data/mercure.db}
27-
# Publisher JWT key
28-
publisher_jwt {env.MERCURE_PUBLISHER_JWT_KEY} {env.MERCURE_PUBLISHER_JWT_ALG}
29-
# Subscriber JWT key
30-
subscriber_jwt {env.MERCURE_SUBSCRIBER_JWT_KEY} {env.MERCURE_SUBSCRIBER_JWT_ALG}
31-
# Allow anonymous subscribers (double-check that it's what you want)
32-
anonymous
33-
# Enable the subscription API (double-check that it's what you want)
34-
subscriptions
35-
# Extra directives
36-
{$MERCURE_EXTRA_DIRECTIVES}
37-
}
38-
39-
vulcain
40-
41-
# Add links to the API docs and to the Mercure Hub if not set explicitly (e.g. the PWA)
42-
header ?Link `</docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation", </.well-known/mercure>; rel="mercure"`
43-
# Disable Topics tracking if not enabled explicitly: https://github.com/jkarlin/topics
44-
header ?Permissions-Policy "browsing-topics=()"
45-
46-
# Matches requests for HTML documents, for static files and for Next.js files,
47-
# except for known API paths and paths with extensions handled by API Platform
48-
@pwa expression `(
49-
header({'Accept': '*text/html*'})
50-
&& !path(
51-
'/docs*', '/graphql*', '/bundles*', '/contexts*', '/_profiler*', '/_wdt*',
52-
'*.json*', '*.html', '*.csv', '*.yml', '*.yaml', '*.xml'
53-
)
54-
)
55-
|| path('/favicon.ico', '/manifest.json', '/robots.txt', '/sitemap*', '/_next*', '/__next*')
56-
|| query({'_rsc': '*'})`
57-
58-
# Comment the following line if you don't want Next.js to catch requests for HTML documents.
59-
# In this case, they will be handled by the PHP app.
60-
# reverse_proxy @pwa http://{$PWA_UPSTREAM}
61-
6216
php_server
6317
}

frankenphp/Dockerfile

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,15 @@ ARG FRANKENPHP_VERSION=1.5-php8.2-alpine
66
# Versions
77
FROM dunglas/frankenphp:${FRANKENPHP_VERSION} AS frankenphp_upstream
88

9-
109
# The different stages of this Dockerfile are meant to be built into separate images
1110
# https://docs.docker.com/develop/develop-images/multistage-build/#stop-at-a-specific-build-stage
1211
# https://docs.docker.com/compose/compose-file/#target
1312

14-
1513
# Base FrankenPHP image
1614
FROM frankenphp_upstream AS frankenphp_base
1715

1816
WORKDIR /srv/sylius
1917

20-
# persistent / runtime deps
21-
# hadolint ignore=DL3008
22-
RUN if grep -q "Ubuntu" /etc/os-release; then \
23-
apt-get update \
24-
&& apt-get install --no-install-recommends -y \
25-
acl \
26-
file \
27-
gettext \
28-
git \
29-
libnss3-tools \
30-
&& rm -rf /var/lib/apt/lists/*; \
31-
elif grep -q "Alpine Linux" /etc/os-release; then \
32-
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS linux-headers \
33-
&& apk add --no-cache \
34-
acl \
35-
file \
36-
gettext \
37-
git \
38-
nss-tools \
39-
curl \
40-
&& apk del .build-deps; \
41-
fi
42-
4318
# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
4419
ENV COMPOSER_ALLOW_SUPERUSER=1
4520

@@ -56,32 +31,26 @@ RUN install-php-extensions \
5631
zip
5732

5833
COPY --link conf.d/app.ini $PHP_INI_DIR/conf.d/
59-
COPY --link --chmod=755 docker-entrypoint.sh /usr/local/bin/docker-entrypoint
34+
COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/
6035
COPY --link Caddyfile /etc/caddy/Caddyfile
6136

62-
ENTRYPOINT ["docker-entrypoint"]
63-
6437
HEALTHCHECK --start-period=60s CMD curl -f http://localhost:2019/metrics || exit 1
6538
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile" ]
6639

67-
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini.production.backup"
68-
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini.development.backup"
69-
7040
# Dev FrankenPHP image
7141
FROM frankenphp_base AS frankenphp_dev
7242

7343
ENV APP_ENV=dev XDEBUG_MODE=off
7444
VOLUME /app/var/
7545

76-
RUN cp "$PHP_INI_DIR/php.ini.development.backup" "$PHP_INI_DIR/php.ini"
46+
RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"
7747

7848
RUN set -eux; \
7949
install-php-extensions \
8050
xdebug \
8151
;
8252

8353
COPY --link conf.d/app.dev.ini $PHP_INI_DIR/conf.d/
84-
COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/
8554

8655
CMD [ "frankenphp", "run", "--config", "/etc/caddy/Caddyfile", "--watch" ]
8756

@@ -91,8 +60,7 @@ FROM frankenphp_base AS frankenphp_prod
9160
ENV APP_ENV=prod
9261
ENV FRANKENPHP_CONFIG="import worker.Caddyfile"
9362

94-
RUN cp "$PHP_INI_DIR/php.ini.production.backup" "$PHP_INI_DIR/php.ini"
63+
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
9564

9665
COPY --link conf.d/app.prod.ini $PHP_INI_DIR/conf.d/
97-
COPY --link conf.d/app-cli.ini $PHP_INI_DIR/conf.d/
9866
COPY --link worker.Caddyfile /etc/caddy/worker.Caddyfile

frankenphp/conf.d/app.dev.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
; See https://docs.docker.com/desktop/networking/#i-want-to-connect-from-a-container-to-a-service-on-the-host
2+
; See https://github.com/docker/for-linux/issues/264
3+
; The `client_host` below may optionally be replaced with `discover_client_host=yes`
4+
; Add `start_with_request=yes` to start debug session on each request
5+
xdebug.client_host = xdebug://gateway

frankenphp/docker-entrypoint.sh

Lines changed: 0 additions & 40 deletions
This file was deleted.

frankenphp/xdebug.Dockerfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)