From 5f649f4b2f24955b25c4b27707d236b00f2e3476 Mon Sep 17 00:00:00 2001 From: Tobias Hargesheimer Date: Mon, 23 Dec 2024 19:08:11 +0100 Subject: [PATCH] Update proxyscotch.scratch.Dockerfile --- proxyscotch.scratch.Dockerfile | 37 +++++++++++++++------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/proxyscotch.scratch.Dockerfile b/proxyscotch.scratch.Dockerfile index cd11442..3b777c5 100644 --- a/proxyscotch.scratch.Dockerfile +++ b/proxyscotch.scratch.Dockerfile @@ -2,27 +2,21 @@ FROM golang:alpine AS builder ARG VERSION -# Proxyscotch -RUN \ - apk add --no-cache git ; \ - VERSION=${VERSION:-$(wget -qO- https://api.github.com/repos/hoppscotch/proxyscotch/tags | grep 'name' | cut -d\" -f4 | sort -r | sed -n 's/^v[0-9]\+\.[0-9]\+\.[0-9]\+$/&/p' | head -1)} ; \ +SHELL ["/bin/ash", "-euxo", "pipefail", "-c"] + +WORKDIR /go/src/proxyscotch + +# hadolint ignore=DL3018,SC2046 +RUN apk add --no-cache git ; \ + #VERSION=${VERSION:-$(wget -qO- https://api.github.com/repos/hoppscotch/proxyscotch/tags | grep 'name' | cut -d\" -f4 | sort -r | sed -n 's/^v[0-9]\+\.[0-9]\+\.[0-9]\+$/&/p' | head -1)} ; \ + VERSION=${VERSION:-$(wget -qO- https://api.github.com/repos/hoppscotch/proxyscotch/releases/latest | grep 'tag_name' | cut -d\" -f4)} ; \ echo "Proxyscotch Version = ${VERSION}" ; \ - BUILD_OS=$(go env GOOS) ; \ - BUILD_ARCH=$(go env GOARCH) ; \ - cd /go ; \ - git clone --branch ${VERSION} --single-branch https://github.com/hoppscotch/proxyscotch.git ./proxyscotch ; \ - cd /go/proxyscotch ; \ - # prepare for other arch https://github.com/hoppscotch/proxyscotch/blob/master/build.sh#L329 - sed -i "s/amd64/${BUILD_ARCH}/" build.sh ; \ - ./build.sh ${BUILD_OS} server ; \ - cp ./out/${BUILD_OS}-server/proxyscotch-server-${BUILD_OS}-${BUILD_ARCH}-${VERSION} /usr/local/bin/proxyscotch ; \ + git clone --branch "${VERSION}" --single-branch https://github.com/hoppscotch/proxyscotch.git . ; \ + export $(grep -v '^#' version.properties | xargs) ; \ + # https://github.com/hoppscotch/proxyscotch/blob/master/build.sh#L217 + GOOS="$(go env GOOS)" GOARCH="$(go env GOARCH)" go build -ldflags "-X main.VersionName=$VERSION_NAME -X main.VersionCode=$VERSION_CODE" -o "${GOPATH}/bin/proxyscotch" server/server.go ; \ proxyscotch --help -# CAs -#COPY *.crt /usr/local/share/ca-certificates/ -#RUN \ -# update-ca-certificates - FROM scratch @@ -31,8 +25,8 @@ ARG VCS_REF ARG BUILD_DATE LABEL org.opencontainers.image.title="Proxyscotch" \ - org.opencontainers.image.vendor="" \ - org.opencontainers.image.authors="" \ + #org.opencontainers.image.vendor="" \ + #org.opencontainers.image.authors="" \ org.opencontainers.image.version="${VERSION}" \ org.opencontainers.image.created="${BUILD_DATE}" \ org.opencontainers.image.revision="${VCS_REF}" \ @@ -44,7 +38,8 @@ LABEL org.opencontainers.image.title="Proxyscotch" \ org.opencontainers.image.source="https://github.com/hoppscotch/proxyscotch" COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=builder --chown=1000:100 /usr/local/bin/proxyscotch /usr/local/bin/proxyscotch +COPY --from=builder /go/bin/proxyscotch /usr/local/bin/proxyscotch +#COPY --from=builder /go/src/proxyscotch/LICENSE /LICENSE EXPOSE 9159/tcp USER 1000:100