ARG BASE_IMAGE=golang:1.20.14-alpine3.19 FROM $BASE_IMAGE ARG POSTGRES_PACKAGE=postgresql14 RUN apk update && \ apk add --no-cache \ build-base \ make \ $POSTGRES_PACKAGE \ $POSTGRES_PACKAGE-contrib \ $POSTGRES_PACKAGE-client WORKDIR /pg-schema-diff COPY . . # Download dependencies so they are cached in a layer RUN go mod download # Run all tests from non-root. This will also prevent Postgres from complaining when # we try to launch it within tests RUN adduser --disabled-password --gecos '' testrunner USER testrunner # Run tests serially so logs can be streamed. Set overall timeout to 30m (the default is 10m, which is not enough) CMD ["-v", "-race", "-p", "1", "./...", "-timeout", "30m"] ENTRYPOINT ["go", "test"]