-
Notifications
You must be signed in to change notification settings - Fork 256
/
Dockerfile.build
32 lines (28 loc) · 1.4 KB
/
Dockerfile.build
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
# Dependencies and linters for build:
FROM golang:1.23.3@sha256:8956c08c8129598db36e92680d6afda0079b6b32b93c2c08260bf6fa75524e07
# 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 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 set -x; if [ x"$(dpkg --print-architecture)" != x"s390x" ]; then \
curl -fsSL "https://download.docker.com/linux/debian/gpg" | apt-key add; \
echo "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian bullseye stable" > /etc/apt/sources.list.d/docker.list && \
apt-get -y update && apt-get install --no-install-recommends -y docker-ce docker-buildx-plugin; \
fi
# 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