Skip to content

Commit

Permalink
Refactor Dockerfile to follow GOST's new release filename syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
cmj2002 committed Oct 12, 2024
1 parent 7fa9ce1 commit 3ac204e
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN case ${TARGETPLATFORM} in \
"linux/arm64") export ARCH="armv8" ;; \
*) echo "Unsupported TARGETPLATFORM: ${TARGETPLATFORM}" && exit 1 ;; \
esac && \
echo "Building for ${ARCH} with GOST ${GOST_VERSION}" &&\
echo "Building for ${TARGETPLATFORM} with GOST ${GOST_VERSION}" &&\
apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl gnupg lsb-release sudo jq ipcalc && \
Expand All @@ -30,9 +30,27 @@ RUN case ${TARGETPLATFORM} in \
apt-get install -y cloudflare-warp && \
apt-get clean && \
apt-get autoremove -y && \
curl -LO https://github.com/ginuerzh/gost/releases/download/v${GOST_VERSION}/gost-linux-${ARCH}-${GOST_VERSION}.gz && \
gunzip gost-linux-${ARCH}-${GOST_VERSION}.gz && \
mv gost-linux-${ARCH}-${GOST_VERSION} /usr/bin/gost && \
MAJOR_VERSION=$(echo ${GOST_VERSION} | cut -d. -f1) && \
MINOR_VERSION=$(echo ${GOST_VERSION} | cut -d. -f2) && \
# detect if version >= 2.12.0, which uses new filename syntax
if [ "${MAJOR_VERSION}" -ge 3 ] || [ "${MAJOR_VERSION}" -eq 2 -a "${MINOR_VERSION}" -ge 12 ]; then \
NAME_SYNTAX="new" && \
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
ARCH="arm64"; \
fi && \
FILE_NAME="gost_${GOST_VERSION}_linux_${ARCH}.tar.gz"; \
else \
NAME_SYNTAX="legacy" && \
FILE_NAME="gost-linux-${ARCH}-${GOST_VERSION}.gz"; \
fi && \
echo "File name: ${FILE_NAME}" && \
curl -LO https://github.com/ginuerzh/gost/releases/download/v${GOST_VERSION}/${FILE_NAME} && \
if [ "${NAME_SYNTAX}" = "new" ]; then \
tar -xzf ${FILE_NAME} -C /usr/bin/ gost; \
else \
gunzip ${FILE_NAME} && \
mv gost-linux-${ARCH}-${GOST_VERSION} /usr/bin/gost; \
fi && \
chmod +x /usr/bin/gost && \
chmod +x /entrypoint.sh && \
chmod +x /healthcheck/index.sh && \
Expand Down

0 comments on commit 3ac204e

Please sign in to comment.