diff --git a/ci/pre-commit/Dockerfile b/ci/pre-commit/Dockerfile index 2c90d43..9aee757 100644 --- a/ci/pre-commit/Dockerfile +++ b/ci/pre-commit/Dockerfile @@ -1,4 +1,40 @@ FROM alpine:latest -# install node (Alpine) -RUN apk add --no-cache nodejs npm gcc build-base musl-dev curl make \ No newline at end of file +# Install system dependencies +RUN apk add --no-cache \ + nodejs \ + npm \ + gcc \ + build-base \ + musl-dev \ + curl \ + make \ + wget \ + tar \ + bash \ + git \ + protobuf \ + protobuf-dev + +# Install Go 1.25.3 +RUN cd /tmp && \ + wget -q https://go.dev/dl/go1.25.3.linux-amd64.tar.gz && \ + tar -C /usr/local -xzf go1.25.3.linux-amd64.tar.gz && \ + rm go1.25.3.linux-amd64.tar.gz + +# Set up Go environment +ENV PATH=/usr/local/go/bin:$PATH:/root/go/bin +ENV GOROOT=/usr/local/go +ENV GOPATH=/root/go +ENV CGO_ENABLED=1 +ENV GOFLAGS=-buildvcs=false + +# Install Go protobuf plugins +RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \ + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest + +# Install golangci-lint +RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /root/go/bin + +# Set working directory +WORKDIR /workspace \ No newline at end of file diff --git a/scripts/pre-commit-check.sh b/scripts/pre-commit-check.sh index 89b33b3..be075e9 100755 --- a/scripts/pre-commit-check.sh +++ b/scripts/pre-commit-check.sh @@ -30,32 +30,10 @@ docker run --rm \ -w /workspace \ "$IMAGE_NAME:latest" \ sh -c " - echo '๐Ÿ“ฆ Installing Go 1.25.3 and required tools...' - apk add --no-cache protobuf protobuf-dev bash git wget tar make || exit 1 - - # Install Go 1.25.3 - cd /tmp && \ - wget -q https://go.dev/dl/go1.25.3.linux-amd64.tar.gz && \ - tar -C /usr/local -xzf go1.25.3.linux-amd64.tar.gz && \ - rm go1.25.3.linux-amd64.tar.gz || exit 1 - - export PATH=/usr/local/go/bin:\$PATH:/root/go/bin - export GOROOT=/usr/local/go - export GOPATH=/root/go - - echo '๐Ÿ“ฅ Installing Go protobuf plugins...' - go install google.golang.org/protobuf/cmd/protoc-gen-go@latest || exit 1 - go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest || exit 1 - - echo '๐Ÿ“ฅ Installing golangci-lint...' - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /root/go/bin || exit 1 - echo '๐Ÿ“‹ Running make fmt-check...' - cd /workspace && make fmt-check || exit 1 + make fmt-check || exit 1 echo '๐Ÿ” Running make lint...' - export CGO_ENABLED=1 - export GOFLAGS=-buildvcs=false make lint || exit 1 echo '๐Ÿงช Running make test...'