Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
dunglas committed Jul 10, 2024
1 parent 790d3aa commit a571d0c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
22 changes: 17 additions & 5 deletions alpine.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,32 @@ RUN apk add --no-cache --virtual .build-deps \
readline-dev \
sqlite-dev \
upx \
# Needed by gotip
# Needed for the custom Go build
git \
bash

RUN GOBIN=/usr/local/go/bin go install golang.org/dl/gotip@latest && (yes || true) | gotip download 585817
# FIXME: temporary workaround for https://github.com/dunglas/symfony-docker/issues/646
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
RUN ./make.bash
ENV PATH="/goroot/bin:$PATH"
RUN go version

WORKDIR /go/src/app

COPY --link go.mod go.sum ./
RUN gotip mod graph | awk '{if ($1 !~ "@") print $2}' | xargs gotip get
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get

WORKDIR /go/src/app/caddy
COPY caddy/go.mod caddy/go.sum ./
RUN gotip mod graph | awk '{if ($1 !~ "@") print $2}' | xargs gotip get
RUN go mod graph | awk '{if ($1 !~ "@") print $2}' | xargs go get

WORKDIR /go/src/app
COPY --link *.* ./
Expand All @@ -91,7 +103,7 @@ COPY --link testdata testdata
ENV CGO_LDFLAGS="-lssl -lcrypto -lreadline -largon2 -lcurl -lonig -lz $PHP_LDFLAGS" CGO_CFLAGS="-DFRANKENPHP_VERSION=$FRANKENPHP_VERSION $PHP_CFLAGS" CGO_CPPFLAGS=$PHP_CPPFLAGS

WORKDIR /go/src/app/caddy/frankenphp
RUN GOBIN=/usr/local/bin gotip install -ldflags "-w -s -extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" && \
RUN GOBIN=/usr/local/bin go install -ldflags "-w -s -extldflags '-Wl,-z,stack-size=0x80000' -X 'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP $FRANKENPHP_VERSION PHP $PHP_VERSION Caddy'" && \
setcap cap_net_bind_service=+ep /usr/local/bin/frankenphp && \
upx --best /usr/local/bin/frankenphp && \
frankenphp version
Expand Down
4 changes: 1 addition & 3 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,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 = "./"
Expand Down
14 changes: 14 additions & 0 deletions static-builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ RUN apk update; \
xz ; \
ln -sf /usr/bin/php83 /usr/bin/php

# FIXME: temporary workaround for https://github.com/dunglas/symfony-docker/issues/646
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
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
Expand Down

0 comments on commit a571d0c

Please sign in to comment.