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

Set FrankenPHP and PHP version when building with xcaddy #1364

Open
kichetof opened this issue Feb 7, 2025 · 2 comments
Open

Set FrankenPHP and PHP version when building with xcaddy #1364

kichetof opened this issue Feb 7, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@kichetof
Copy link

kichetof commented Feb 7, 2025

Describe you feature request

Hi,

I build a docker image according to How to Install More Caddy Modules. Everything works well!

I can show when displaying FrankenPHP version echo phpversion('frankenphp');, it display "dev" instead of "vX.X.X".

I tried with both env (VERSION or FRANKENPHP_VERSION), but nothing works as expected:

ARG PHP_VERSION=8.3
ARG FRANKENPHP_VERSION=1

FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-builder-php${PHP_VERSION} AS builder
COPY --from=caddy:builder /usr/bin/xcaddy /usr/bin/xcaddy
RUN CGO_ENABLED=1 \
    XCADDY_SETCAP=1 \
    XCADDY_GO_BUILD_FLAGS="-ldflags='-w -s' -tags=nobadger,nomysql,nopgx" \
    #VERSION=$(echo $CGO_CFLAGS | grep -oP '(?<=-DFRANKENPHP_VERSION=)[^ ]+') \
    #FRANKENPHP_VERSION=$(echo $CGO_CFLAGS | grep -oP '(?<=-DFRANKENPHP_VERSION=)[^ ]+') \
    CGO_CFLAGS=$(php-config --includes) \
    CGO_LDFLAGS="$(php-config --ldflags) $(php-config --libs)" \
    xcaddy build \
        --output /usr/local/bin/frankenphp \
        --with github.com/dunglas/frankenphp=./ \
        --with github.com/dunglas/frankenphp/caddy=./caddy/ \
        --with github.com/dunglas/caddy-cbrotli

FROM dunglas/frankenphp:${FRANKENPHP_VERSION}-php${PHP_VERSION} AS base

COPY --from=builder /usr/local/bin/frankenphp /usr/local/bin/frankenphp-test

And my versions output:

root@6ab7bfe37678:/app# frankenphp -v
FrankenPHP v1.4.2 PHP 8.3.16 Caddy v2.9.1 h1:OEYiZ7DbCzAWVb6TNEkjRcSCRGHVoZsJinoDR/n9oaY=
root@6ab7bfe37678:/app# frankenphp-test -v
v2.9.1 h1:OEYiZ7DbCzAWVb6TNEkjRcSCRGHVoZsJinoDR/n9oaY=

Should it be possible to tag the builder version according to the FrankenPHP tagged version in the builder image ?

Thanks a lot!!

@kichetof kichetof added the enhancement New feature or request label Feb 7, 2025
@kichetof
Copy link
Author

could be related to #1248 (comment)

@withinboredom
Copy link
Collaborator

Indeed! I believe it is exactly related. Hoping to get to that this weekend actually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants