-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
38 lines (25 loc) · 764 Bytes
/
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
FROM golang:1.20-alpine3.16 as builder
WORKDIR /piper
RUN apk update && apk add --no-cache \
git \
make \
wget \
curl \
gcc \
bash \
ca-certificates \
musl-dev \
zlib-static \
build-base
COPY go.mod .
COPY go.sum .
RUN --mount=type=cache,target=/go/pkg/mod go mod download
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build go mod tidy
RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/go-build go build -gcflags='all=-N -l' -tags=alpine -buildvcs=false -trimpath ./cmd/piper
FROM alpine:3.16 as piper-release
ENV GIN_MODE=release
USER 1001
COPY .git /.git
COPY --chown=1001 --from=builder /piper/piper /bin
ENTRYPOINT [ "piper" ]