diff --git a/autobahn/docker/autobahn/Dockerfile b/autobahn/docker/autobahn/Dockerfile index 0726c39..e2e6a52 100644 --- a/autobahn/docker/autobahn/Dockerfile +++ b/autobahn/docker/autobahn/Dockerfile @@ -1,16 +1,6 @@ -# Based on https://github.com/crossbario/autobahn-testsuite/blob/09cfbf74b0c8e335c6fc7df88e5c88349ca66879/docker/Dockerfile - -FROM pypy:2-slim - -# make "pypy" available as "python" -RUN ln -s /usr/local/bin/pypy /usr/local/bin/python - -# We need this to fix pip & cryptography -RUN apt-get update && apt-get install -y build-essential libssl-dev - -# install Autobahn|Testsuite -RUN pip install -U pip typing && \ - pip install autobahntestsuite=='0.8.2' +# Use the upstream Autobahn|Testsuite image, pinned by version so that CI runs +# are reproducible; bump it deliberately. +FROM crossbario/autobahn-testsuite:25.10.1 VOLUME /config VOLUME /report diff --git a/autobahn/docker/server/Dockerfile b/autobahn/docker/server/Dockerfile index e457c61..01757a5 100644 --- a/autobahn/docker/server/Dockerfile +++ b/autobahn/docker/server/Dockerfile @@ -1,4 +1,8 @@ -FROM golang:1.20.2-alpine3.17 +# GO_VERSION is passed by autobahn/script/test.sh from the host's +# `go env GOVERSION`, so the server under test is built with the same Go as the +# CI matrix entry. The default is only a fallback for manual builds. +ARG GO_VERSION=1.27 +FROM golang:${GO_VERSION}-alpine WORKDIR /go/src/github.com/gobwas/ws diff --git a/autobahn/script/test.sh b/autobahn/script/test.sh index 99fe120..a4785a5 100755 --- a/autobahn/script/test.sh +++ b/autobahn/script/test.sh @@ -2,6 +2,14 @@ FOLLOW_LOGS=0 +# Build the server image with the same Go version as the host (e.g. the CI +# matrix entry). GO_VERSION may be set explicitly to override it. +GO_VERSION="${GO_VERSION:-$(go env GOVERSION 2>/dev/null | sed 's/^go//')}" +SERVER_BUILD_ARGS=() +if [[ -n "$GO_VERSION" ]]; then + SERVER_BUILD_ARGS+=(--build-arg "GO_VERSION=$GO_VERSION") +fi + while [[ $# -gt 0 ]]; do key="$1" case $key in @@ -13,16 +21,16 @@ while [[ $# -gt 0 ]]; do --build) case "$2" in autobahn) - docker build . --file autobahn/docker/autobahn/Dockerfile --tag ws-autobahn + docker build . --file autobahn/docker/autobahn/Dockerfile --tag ws-autobahn || exit 1 shift ;; server) - docker build . --file autobahn/docker/server/Dockerfile --tag ws-server + docker build . --file autobahn/docker/server/Dockerfile --tag ws-server "${SERVER_BUILD_ARGS[@]}" || exit 1 shift ;; *) - docker build . --file autobahn/docker/autobahn/Dockerfile --tag ws-autobahn - docker build . --file autobahn/docker/server/Dockerfile --tag ws-server + docker build . --file autobahn/docker/autobahn/Dockerfile --tag ws-autobahn || exit 1 + docker build . --file autobahn/docker/server/Dockerfile --tag ws-server "${SERVER_BUILD_ARGS[@]}" || exit 1 ;; esac ;;