-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathDockerfile
More file actions
41 lines (30 loc) · 1.18 KB
/
Dockerfile
File metadata and controls
41 lines (30 loc) · 1.18 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
39
40
41
# syntax=docker/dockerfile:1.23.0@sha256:2780b5c3bab67f1f76c781860de469442999ed1a0d7992a5efdf2cffc0e3d769
FROM registry.suse.com/bci/golang:1.26@sha256:59204a1a28ed065b75c8e3e8dabbe120d2b31dab820cddb67f0bee1ae8d6421b AS base
ARG TARGETARCH
ARG http_proxy
ARG https_proxy
ENV GOLANGCI_LINT_VERSION=v2.11.4
ENV ARCH=${TARGETARCH}
ENV GOFLAGS=-mod=vendor
# Install packages
RUN zypper update -y && \
zypper -n install curl awk && \
rm -rf /var/cache/zypp/*
# Install golangci-lint
RUN curl -fsSL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh -o /tmp/install.sh \
&& chmod +x /tmp/install.sh \
&& /tmp/install.sh -b /usr/local/bin ${GOLANGCI_LINT_VERSION}
WORKDIR /go/src/github.com/longhorn/cli
COPY . .
FROM base AS build
RUN ./scripts/build
FROM base AS validate
RUN ./scripts/validate && touch /validate.done
FROM base AS test
RUN ./scripts/test
FROM scratch AS build-artifacts
COPY --from=build /go/src/github.com/longhorn/cli/bin/ /bin/
FROM scratch AS ci-artifacts
COPY --from=build /go/src/github.com/longhorn/cli/bin/ /bin/
COPY --from=validate /validate.done /validate.done
COPY --from=test /go/src/github.com/longhorn/cli/coverage.out /coverage.out