diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 0b1b9970..1648bfcd 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,10 +13,6 @@ updates: "GitHub Actions updates": patterns: - "*" - - package-ecosystem: "docker" - directory: "/" - schedule: - interval: "monthly" - package-ecosystem: "gomod" directory: "/" schedule: @@ -24,8 +20,6 @@ updates: groups: "Go modules updates": dependency-type: "production" - "Go modules updates for tests": - dependency-type: "development" - package-ecosystem: "gomod" directory: "/examples/plugin" schedule: @@ -33,5 +27,3 @@ updates: groups: "Go modules updates": dependency-type: "production" - "Go modules updates for tests": - dependency-type: "development" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7daf2cc6..9d31fa10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,12 +22,20 @@ jobs: - name: build and test run: | - go test -v -timeout=100s -covermode=count -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./... + go test -race -v -timeout=100s -covermode=atomic -coverprofile=$GITHUB_WORKSPACE/profile.cov_tmp ./... + go build -race ./... cat $GITHUB_WORKSPACE/profile.cov_tmp | grep -v "mocks" | grep -v "_mock" > $GITHUB_WORKSPACE/profile.cov working-directory: app env: TZ: "America/Chicago" + - name: test examples + run: | + go test -race ./... + go build -race ./... + working-directory: examples/plugin + env: + TZ: "America/Chicago" - name: golangci-lint uses: golangci/golangci-lint-action@v6 diff --git a/Dockerfile b/Dockerfile index 6aeb07d7..cb06c367 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,19 +18,12 @@ RUN \ echo "version=$version" && \ cd app && go build -o /build/reproxy -ldflags "-X main.revision=${version} -s -w" - -FROM ghcr.io/umputun/baseimage/app:v1.12.0 as base - -FROM scratch +FROM umputun/baseimage:scratch-latest # enables automatic changelog generation by tools like Dependabot LABEL org.opencontainers.image.source="https://github.com/umputun/reproxy" ENV REPROXY_IN_DOCKER=1 COPY --from=backend /build/reproxy /srv/reproxy -COPY --from=base /usr/share/zoneinfo /usr/share/zoneinfo -COPY --from=base /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=base /etc/passwd /etc/passwd -COPY --from=base /etc/group /etc/group WORKDIR /srv ENTRYPOINT ["/srv/reproxy"] diff --git a/README.md b/README.md index 13fe1f8a..56093a86 100644 --- a/README.md +++ b/README.md @@ -210,7 +210,7 @@ Custom 404 (not found) page can be set with `--assets.404=` parameter. The Serving purely static content is one of the popular use cases. Usually this used for the separate frontend container providing UI only. With the assets server such a container is almost trivial to make. This is an example from the container serving [reproxy.io](http://reproxy.io) ```docker -FROM node:16-alpine as build +FROM node:22-alpine as build WORKDIR /build COPY site/ /build diff --git a/app/proxy/health_test.go b/app/proxy/health_test.go index 59477d14..520133b4 100644 --- a/app/proxy/health_test.go +++ b/app/proxy/health_test.go @@ -10,6 +10,7 @@ import ( "net/http/httptest" "strconv" "strings" + "sync" "testing" "time" @@ -73,7 +74,10 @@ func TestHttp_healthHandler(t *testing.T) { })) var count int + var mux sync.Mutex ps := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + mux.Lock() + defer mux.Unlock() count++ t.Logf("req: %v", r) if r.URL.Path == "/123/ping" { diff --git a/examples/plugin/Dockerfile b/examples/plugin/Dockerfile index e34f139e..8627aec6 100644 --- a/examples/plugin/Dockerfile +++ b/examples/plugin/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.16-alpine as build +FROM golang:1.22-alpine as build ENV CGO_ENABLED=0 @@ -8,8 +8,6 @@ WORKDIR /build RUN go build -o /build/plugin-example -ldflags "-X main.revision=${version} -s -w" -FROM ghcr.io/umputun/baseimage/app:v1.6.1 as base - FROM scratch COPY --from=build /build/plugin-example /srv/plugin-example