dunglas / mercure

🪽 An open, easy, fast, reliable and battery-efficient solution for real-time communications
https://mercure.rocks
GNU Affero General Public License v3.0
3.99k stars 297 forks source link

Docker xcaddy build fails with latest version of mercure #537

Closed zspine closed 3 years ago

zspine commented 3 years ago

Partial error log

go: downloading github.com/spaolacci/murmur3 v1.1.0
go: downloading github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7
go: downloading golang.org/x/mod v0.4.0
go: downloading github.com/jmespath/go-jmespath v0.3.0
2021/07/18 14:53:26 [INFO] exec (timeout=0s): /usr/local/go/bin/go build -o /usr/bin/caddy -ldflags -w -s -trimpath 
/go/pkg/mod/github.com/dunglas/mercure@v0.12.0/demo.go:4:2: package embed is not in GOROOT (/usr/local/go/src/embed)
/go/pkg/mod/github.com/dunglas/mercure@v0.12.0/handler.go:7:2: package io/fs is not in GOROOT (/usr/local/go/src/io/fs)
2021/07/18 14:53:30 [INFO] Skipping cleanup as requested; leaving folder intact: /tmp/buildenv_2021-07-18-1452.189573182
2021/07/18 14:53:30 [FATAL] exit status 1
ERROR: Service 'caddy' failed to build: The command '/bin/sh -c xcaddy build    --with github.com/dunglas/vulcain/caddy     --with github.com/dunglas/mercure/caddy' returned a non-zero code: 1
FROM caddy:${CADDY_VERSION}-builder-alpine AS api_platform_caddy_builder

RUN xcaddy build \
    --with github.com/dunglas/vulcain/caddy \
        --with github.com/dunglas/mercure/caddy

FROM caddy:${CADDY_VERSION} AS api_platform_caddy

WORKDIR /srv/api

COPY --from=api_platform_caddy_builder /usr/bin/caddy /usr/bin/caddy
COPY --from=api_platform_php /srv/api/public public/
COPY docker/caddy/Caddyfile /etc/caddy/Caddyfile

Only happens with custom xcaddy build and docker hub version works fine!

zspine commented 3 years ago

Sorry this issue not relevant to mercure.... if anyone else having this problem with api platform try the following workaround:

# Skip the custom build
#FROM caddy:${CADDY_VERSION}-builder-alpine AS api_platform_caddy_builder
#
#RUN xcaddy build \
#   --with github.com/dunglas/vulcain/caddy \
#       --with github.com/dunglas/mercure/caddy

FROM caddy:${CADDY_VERSION} AS api_platform_caddy

WORKDIR /srv/api

COPY --from=dunglas/mercure:v0.12 /usr/bin/caddy /usr/bin/caddy
COPY --from=api_platform_php /srv/api/public public/
COPY docker/caddy/Caddyfile /etc/caddy/Caddyfile