@@ -30,6 +30,7 @@ FROM build AS binary
30
30
ARG TARGETOS
31
31
ARG TARGETARCH
32
32
ARG BIN_NAME
33
+ ARG NO_ARCHIVE
33
34
ENV CGO_ENABLED=0
34
35
RUN --mount=type=cache,target=/root/.cache \
35
36
--mount=type=cache,target=/go/pkg/mod \
@@ -41,19 +42,20 @@ RUN --mount=type=cache,target=/root/.cache \
41
42
-X $PKG_NAME/internal/constants.Version=$GIT_VERSION" \
42
43
./cmd/${BIN_NAME} && \
43
44
xx-verify dist/${BIN_NAME} && \
44
- # on windows add the .exe extension and zip the binary \
45
- if [ "${TARGETOS}" = "windows" ]; then \
46
- mv dist/${BIN_NAME} dist/${BIN_NAME}.exe && \
47
- cd dist && zip ${BIN_NAME}-${TARGETOS}-${TARGETARCH}.zip ${BIN_NAME}.exe; \
48
- fi && \
49
- # if target os is not windows, tar and gzip the binary \
50
- if [ "${TARGETOS}" != "windows" ]; then \
51
- tar -C dist -czf dist/${BIN_NAME}-${TARGETOS}-${TARGETARCH}.tar.gz ${BIN_NAME}; \
45
+ if [ -z "${NO_ARCHIVE}" ]; then \
46
+ # on windows add the .exe extension and zip the binary \
47
+ if [ "${TARGETOS}" = "windows" ]; then \
48
+ mv dist/${BIN_NAME} dist/${BIN_NAME}.exe && \
49
+ (cd dist && zip ${BIN_NAME}-${TARGETOS}-${TARGETARCH}.zip ${BIN_NAME}.exe && rm -f ${BIN_NAME}.exe); \
50
+ fi && \
51
+ # if target os is not windows, tar and gzip the binary \
52
+ if [ "${TARGETOS}" != "windows" ]; then \
53
+ tar -C dist -czf dist/${BIN_NAME}-${TARGETOS}-${TARGETARCH}.tar.gz ${BIN_NAME} && rm -f dist/${BIN_NAME}; \
54
+ fi \
52
55
fi
53
56
54
57
FROM scratch AS export-bin
55
58
ARG BIN_NAME
56
59
ARG TARGETOS
57
60
ARG TARGETARCH
58
- COPY --from=binary /go/src/dist/*.zip /
59
- COPY --from=binary /go/src/dist/*.tar.gz /
61
+ COPY --from=binary /go/src/dist/* /
0 commit comments