diff --git a/alpine.Dockerfile b/alpine.Dockerfile index 114d8ed1c..af0140bd5 100644 --- a/alpine.Dockerfile +++ b/alpine.Dockerfile @@ -1,6 +1,8 @@ # syntax=docker/dockerfile:1 FROM php-base AS common +ARG TARGETARCH + WORKDIR /app RUN apk add --no-cache \ @@ -64,7 +66,25 @@ RUN apk add --no-cache --virtual .build-deps \ openssl-dev \ readline-dev \ sqlite-dev \ - upx + upx \ + # Needed for the custom Go build + git \ + bash + +# FIXME: temporary workaround for https://github.com/golang/go/issues/68285 +WORKDIR / +RUN git clone https://go.googlesource.com/go goroot +WORKDIR /goroot +# Revert https://github.com/golang/go/commit/3560cf0afb3c29300a6c88ccd98256949ca7a6f6 to prevent the crash with musl +RUN git config --global user.email "build@example.com" && \ + git config --global user.name "Build" && \ + git checkout "$(go env GOVERSION)" && \ + git revert 3560cf0afb3c29300a6c88ccd98256949ca7a6f6 +WORKDIR /goroot/src +ENV GOHOSTARCH="$TARGETARCH" +RUN ./make.bash +ENV PATH="/goroot/bin:$PATH" +RUN go version WORKDIR /go/src/app diff --git a/docker-bake.hcl b/docker-bake.hcl index 7156cedb2..693b45c24 100644 --- a/docker-bake.hcl +++ b/docker-bake.hcl @@ -82,8 +82,7 @@ target "default" { } contexts = { php-base = "docker-image://php:${php-version}-zts-${os}" - # FIXME: temporary workaround for https://github.com/dunglas/symfony-docker/issues/646 - golang-base = "docker-image://golang:${os == "alpine" ? "1.22.4" : GO_VERSION}-${os}" + golang-base = "docker-image://golang:${GO_VERSION}-${os}" } dockerfile = os == "alpine" ? "alpine.Dockerfile" : "Dockerfile" context = "./" @@ -92,7 +91,8 @@ target "default" { platforms = os == "alpine" ? [ "linux/amd64", "linux/386", - "linux/arm/v6", + # FIXME: armv6 doesn't build in GitHub actions because we use a custom Go build + #"linux/arm/v6", "linux/arm/v7", "linux/arm64", ] : [ @@ -120,9 +120,7 @@ target "default" { target "static-builder" { contexts = { - # FIXME: temporary workaround for https://github.com/dunglas/symfony-docker/issues/646 - #golang-base = "docker-image://golang:${GO_VERSION}-alpine" - golang-base = "docker-image://golang:1.22.4-alpine" + golang-base = "docker-image://golang:${GO_VERSION}-alpine" } dockerfile = "static-builder.Dockerfile" context = "./" diff --git a/static-builder.Dockerfile b/static-builder.Dockerfile index ad4949a06..723b12f7a 100644 --- a/static-builder.Dockerfile +++ b/static-builder.Dockerfile @@ -1,6 +1,8 @@ # syntax=docker/dockerfile:1 FROM golang-base +ARG TARGETARCH + ARG FRANKENPHP_VERSION='' ENV FRANKENPHP_VERSION=${FRANKENPHP_VERSION} @@ -68,6 +70,21 @@ RUN apk update; \ xz ; \ ln -sf /usr/bin/php83 /usr/bin/php +# FIXME: temporary workaround for https://github.com/golang/go/issues/68285 +WORKDIR / +RUN git clone https://go.googlesource.com/go goroot +WORKDIR /goroot +# Revert https://github.com/golang/go/commit/3560cf0afb3c29300a6c88ccd98256949ca7a6f6 to prevent the crash with musl +RUN git config --global user.email "build@example.com" && \ + git config --global user.name "Build" && \ + git checkout "$(go env GOVERSION)" && \ + git revert 3560cf0afb3c29300a6c88ccd98256949ca7a6f6 +WORKDIR /goroot/src +ENV GOHOSTARCH="$TARGETARCH" +RUN ./make.bash +ENV PATH="/goroot/bin:$PATH" +RUN go version + # 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