Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Dec 18, 2024
1 parent 0fd51dd commit 0b27c45
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions build-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ else
if ! type "composer" >/dev/null; then
packages="composer"
fi
if ! type "go" >/dev/null; then
if ! type "go" >/dev/null 2>&1; then
packages="${packages} go"
fi
if [ -n "${RELEASE}" ] && ! type "gh" >/dev/null 2>&1; then
Expand Down Expand Up @@ -122,6 +122,10 @@ else
${spcCommand} build --debug --enable-zts --build-embed ${extraOpts} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
fi

if ! type "xcaddy" >/dev/null 2>&1; then
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
fi

curlGitHubHeaders=(--header "X-GitHub-Api-Version: 2022-11-28")
if [ "${GITHUB_TOKEN}" ]; then
curlGitHubHeaders+=(--header "Authorization: Bearer ${GITHUB_TOKEN}")
Expand Down Expand Up @@ -266,12 +270,17 @@ if [ -z "${XCADDY_ARGS}" ]; then
XCADDY_ARGS="--with github.com/dunglas/mercure/caddy --with github.com/dunglas/vulcain/caddy"
fi

XCADDY_DEBUG=0
if [ -n "${DEBUG_SYMBOLS}" ]; then
XCADDY_DEBUG=1
fi

go env
cd caddy/
go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest
# shellcheck disable=SC2086
CGO_ENABLED=1 \
XCADDY_GO_BUILD_FLAGS="-buildmode=pie -tags cgo,netgo,osusergo,static_build,nobadger,nomysql,nopgx -ldflags \"-linkmode=external -extldflags '-static-pie ${extraExtldflags}' ${extraLdflags} -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ${FRANKENPHP_VERSION} PHP ${LIBPHP_VERSION} Caddy'\"" \
XCADDY_DEBUG="${XCADDY_DEBUG}" \
xcaddy build \
--output "../dist/${bin}" \
${XCADDY_ARGS} \
Expand Down
2 changes: 2 additions & 0 deletions static-builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ RUN ./make.bash
ENV PATH="/goroot/bin:$PATH"
RUN go version

RUN go install github.com/caddyserver/xcaddy/cmd/xcaddy@latest

# https://getcomposer.org/doc/03-cli.md#composer-allow-superuser
ENV COMPOSER_ALLOW_SUPERUSER=1
COPY --from=composer/composer:2-bin /composer /usr/bin/composer
Expand Down

0 comments on commit 0b27c45

Please sign in to comment.