-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
51 lines (43 loc) · 1.12 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
48
49
50
51
ARG GO_VERSION=1.21
ARG MIRROR_REGISTRY
FROM ${MIRROR_REGISTRY}golang:${GO_VERSION}-alpine AS builder-image
RUN apk update && apk add \
binutils \
make \
rpm \
ruby \
ruby-dev \
gcc \
musl-dev \
tar \
msitools \
uuidgen \
coreutils \
zip \
git \
&& gem install fpm
FROM builder-image AS go-test-coverage-stage
WORKDIR /test-coverage
COPY . .
RUN go test ./... -coverprofile=go-coverage.out
FROM scratch AS go-coverage-file
COPY --from=go-test-coverage-stage /test-coverage/go-coverage.out /
FROM builder-image AS ut-stage
WORKDIR /ut
COPY . .
RUN env; go env; go install github.com/jstemmer/go-junit-report/v2@latest
RUN go test -v 2>&1 ./... | go-junit-report > ut-report.xml
FROM scratch AS ut-artifacts
COPY --from=ut-stage /ut/ut-report.xml /
FROM builder-image AS build-stage
WORKDIR /app
COPY . .
RUN make msi GOARCH=amd64 && \
make deb GOARCH=amd64 && \
make rpm GOARCH=amd64 && \
make osx GOARCH=amd64 && \
make deb GOARCH=arm64 && \
make rpm GOARCH=arm64 && \
make osx GOARCH=arm64
FROM scratch AS build-artifacts
COPY --from=build-stage /app/dist /