Skip to content

Can't build with caddy/cache-handler on amd64 #374

Closed
@cdaguerre

Description

@cdaguerre

The following Dockerfile can not be built for amd64 target arch, regardless of the underlying host machine.
It works fine for arm64.

FROM dunglas/frankenphp:latest-builder-php8.3-alpine AS builder

COPY --from=caddy:builder-alpine /usr/bin/xcaddy /usr/bin/xcaddy

ENV CGO_ENABLED=1 XCADDY_SETCAP=1
RUN xcaddy build \
    --output /usr/local/bin/frankenphp \
    --with github.com/dunglas/frankenphp=./ \
    --with github.com/dunglas/frankenphp/caddy=./caddy/ \
    --with github.com/dunglas/mercure/caddy \
    --with github.com/dunglas/vulcain/caddy \
    --with github.com/caddyserver/transform-encoder \
    --with github.com/darkweak/souin/plugins/caddy 	
95.61 2023/12/12 20:31:45 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/local/bin/frankenphp -ldflags -w -s -trimpath 
316.0 # caddy
316.0 /usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
316.0 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/go-link-1036742013/000004.o: warning: relocation against `sapi_module' in read-only section `.text'
316.0 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/go-link-1036742013/000004.o: relocation R_X86_64_PC32 against symbol `stderr' can not be used when making a PDE object; recompile with -fPIE
316.0 /usr/lib/gcc/x86_64-alpine-linux-musl/12.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: final link failed: bad value
316.0 collect2: error: ld returned 1 exit status

Things I've already tried :

  • building without souin works
  • building caddy with souin (without frankenphp) works (regardless of CGO)

Any help would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions