-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
88 lines (59 loc) · 2.11 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
FROM hairyhenderson/upx:3.96 AS upx
FROM golang:1.23-alpine AS build
RUN apk add --no-cache \
make \
libgcc libstdc++ ucl \
git
COPY --from=upx /usr/bin/upx /usr/bin/upx
RUN mkdir -p /go/src/github.com/hairyhenderson/go-which
WORKDIR /go/src/github.com/hairyhenderson/go-which
COPY . /go/src/github.com/hairyhenderson/go-which
ARG VCS_REF
ARG VERSION
ARG CODEOWNERS
RUN make build-x
FROM build AS compress
RUN make compress-all
FROM scratch AS artifacts
COPY --from=compress /go/src/github.com/hairyhenderson/go-which/bin/* /bin/
# gets around error 'Error response from daemon: No command specified'
CMD [ "/bin/which" ]
FROM scratch AS latest
ARG OS=linux
ARG ARCH=amd64
COPY --from=build /go/src/github.com/hairyhenderson/go-which/bin/which_${OS}-${ARCH} /which
ARG VCS_REF
ARG VERSION
ARG CODEOWNERS
LABEL org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.title=go-which \
org.opencontainers.image.authors=$CODEOWNERS \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.source="https://github.com/hairyhenderson/go-which"
ENTRYPOINT [ "/which" ]
FROM alpine:3.20 AS alpine
ARG OS=linux
ARG ARCH=amd64
COPY --from=build /go/src/github.com/hairyhenderson/go-which/bin/which_${OS}-${ARCH} /bin/which
ARG VCS_REF
ARG VERSION
ARG CODEOWNERS
LABEL org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.title=go-which \
org.opencontainers.image.authors=$CODEOWNERS \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.source="https://github.com/hairyhenderson/go-which"
ENTRYPOINT [ "/bin/which" ]
FROM scratch AS slim
ARG OS=linux
ARG ARCH=amd64
COPY --from=compress /go/src/github.com/hairyhenderson/go-which/bin/which_${OS}-${ARCH}-slim /bin/which
ARG VCS_REF
ARG VERSION
ARG CODEOWNERS
LABEL org.opencontainers.image.revision=$VCS_REF \
org.opencontainers.image.title=go-which \
org.opencontainers.image.authors=$CODEOWNERS \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.source="https://github.com/hairyhenderson/go-which"
ENTRYPOINT [ "/which" ]