perf(ci): pre-install all tools in pre-commit Docker image
- Move Go 1.25.3 installation to Dockerfile - Pre-install protobuf plugins and golangci-lint in image - Set environment variables in Dockerfile - Remove runtime installation steps from pre-commit script - Significantly improves pre-commit check performance
This commit is contained in:
@@ -1,4 +1,40 @@
|
||||
FROM alpine:latest
|
||||
|
||||
# install node (Alpine)
|
||||
RUN apk add --no-cache nodejs npm gcc build-base musl-dev curl make
|
||||
# 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
|
||||
Reference in New Issue
Block a user