Skip to content

Commit

Permalink
Update proxyscotch.scratch.Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Tob1as committed Dec 23, 2024
1 parent 4f98290 commit 5f649f4
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions proxyscotch.scratch.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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}" \
Expand All @@ -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
Expand Down

0 comments on commit 5f649f4

Please sign in to comment.