-
Notifications
You must be signed in to change notification settings - Fork 270
Expand file tree
/
Copy pathDockerfile.build
More file actions
38 lines (33 loc) · 1.65 KB
/
Dockerfile.build
File metadata and controls
38 lines (33 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Dependencies and linters for build:
FROM golang:1.25.8@sha256:779b230b2508037a8095c9e2d223a6405f8426e12233b694dbae50197b9f6d04
# When the image isn't yet available and it's urgent:
# ENV GOTOOLCHAIN=go1.25.8
# RUN go version
# Need gcc for -race test (and some linters though those work with CGO_ENABLED=0)
RUN apt-get -y update && \
apt-get --no-install-recommends -y upgrade && \
DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install libc6-dev apt-transport-https ssh \
ruby-dev build-essential rpm gnupg zip netcat-traditional
# Install FPM
RUN gem install --no-document fpm
RUN go version # check it's indeed the version we expect
# golangci-lint
# RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.9.0
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
RUN golangci-lint version
# Docker:
RUN curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc; \
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null; \
apt-get -y update && apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# govulncheck
RUN go install golang.org/x/vuln/cmd/govulncheck@latest
WORKDIR /build
ADD https://raw.githubusercontent.com/fortio/workflows/main/golangci.yml .golangci.yml
VOLUME /build
RUN useradd -m build -d /build
RUN chown -R build:build /build
RUN chown -R build:build /go
USER build