-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
47 lines (33 loc) · 1.29 KB
/
Dockerfile
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
39
40
41
42
43
44
45
46
47
# =============================================================================
# build stage
# =============================================================================
FROM golang:1.23.0-alpine AS builder
WORKDIR /sdk
RUN apk add --no-cache \
build-base \
# curl version should be higher than 7.74 to mitigate SNYK-DEBIAN11-CURL-3320493
curl \
git \
openssh-client \
tzdata
COPY ./go.mod ./go.sum ./
RUN go mod download
COPY . .
# Build Mage: a make-like build tool written in Go
ENV GOBIN=/go/bin
RUN go install cmd/mage/mage.go
RUN CGO_ENABLED=0 GOOS=linux go build ./...
# =============================================================================
# linter stage
# =============================================================================
FROM builder AS linter
# binary will be $(go env GOPATH)/bin/golangci-lint
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
| sh -s -- -b $(go env GOPATH)/bin v1.60.1
# install goimports
RUN go install golang.org/x/tools/cmd/goimports@v0.24.0
# =============================================================================
# development stage
# =============================================================================
FROM linter AS development
RUN go install github.com/go-delve/delve/cmd/dlv@v1.23.0