Update Dockerfile
Browse files- Dockerfile +38 -24
Dockerfile
CHANGED
|
@@ -14,48 +14,62 @@ LABEL COMMIT_SHA=${COMMIT_SHA}
|
|
| 14 |
COPY entrypoint.sh /entrypoint.sh
|
| 15 |
COPY ./healthcheck /healthcheck
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
"linux/amd64") ARCH="amd64" ;; \
|
| 22 |
-
"linux/arm64") ARCH="arm64" ;; \
|
| 23 |
*) echo "Unsupported TARGETPLATFORM: ${TARGETPLATFORM}" && exit 1 ;; \
|
| 24 |
esac && \
|
| 25 |
-
echo "
|
| 26 |
-
|
| 27 |
-
# Install dependencies
|
| 28 |
-
RUN apt-get update && \
|
| 29 |
apt-get upgrade -y && \
|
| 30 |
-
apt-get install -y curl gnupg lsb-release sudo jq ipcalc
|
| 31 |
-
|
| 32 |
-
# Add Cloudflare WARP repository
|
| 33 |
-
RUN curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg && \
|
| 34 |
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/cloudflare-client.list && \
|
| 35 |
apt-get update && \
|
| 36 |
apt-get install -y cloudflare-warp && \
|
| 37 |
apt-get clean && \
|
| 38 |
-
apt-get autoremove -y
|
| 39 |
-
|
| 40 |
-
# Determine GOST file naming convention and download
|
| 41 |
-
RUN MAJOR_VERSION=$(echo ${GOST_VERSION} | cut -d. -f1) && \
|
| 42 |
MINOR_VERSION=$(echo ${GOST_VERSION} | cut -d. -f2) && \
|
| 43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
FILE_NAME="gost_${GOST_VERSION}_linux_${ARCH}.tar.gz"; \
|
| 45 |
else \
|
|
|
|
| 46 |
FILE_NAME="gost-linux-${ARCH}-${GOST_VERSION}.gz"; \
|
| 47 |
fi && \
|
| 48 |
-
echo "
|
| 49 |
curl -LO https://github.com/ginuerzh/gost/releases/download/v${GOST_VERSION}/${FILE_NAME} && \
|
| 50 |
-
if [ "${
|
| 51 |
tar -xzf ${FILE_NAME} -C /usr/bin/ gost; \
|
| 52 |
else \
|
| 53 |
gunzip ${FILE_NAME} && \
|
| 54 |
mv gost-linux-${ARCH}-${GOST_VERSION} /usr/bin/gost; \
|
| 55 |
fi && \
|
| 56 |
-
chmod +x /usr/bin/gost
|
| 57 |
-
|
| 58 |
-
RUN chmod +x /entrypoint.sh && \
|
| 59 |
chmod +x /healthcheck/index.sh && \
|
| 60 |
useradd -m -s /bin/bash warp && \
|
| 61 |
echo "warp ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/warp
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
COPY entrypoint.sh /entrypoint.sh
|
| 15 |
COPY ./healthcheck /healthcheck
|
| 16 |
|
| 17 |
+
# install dependencies
|
| 18 |
+
RUN case ${TARGETPLATFORM} in \
|
| 19 |
+
"linux/amd64") export ARCH="amd64" ;; \
|
| 20 |
+
"linux/arm64") export ARCH="armv8" ;; \
|
|
|
|
|
|
|
| 21 |
*) echo "Unsupported TARGETPLATFORM: ${TARGETPLATFORM}" && exit 1 ;; \
|
| 22 |
esac && \
|
| 23 |
+
echo "Building for ${TARGETPLATFORM} with GOST ${GOST_VERSION}" &&\
|
| 24 |
+
apt-get update && \
|
|
|
|
|
|
|
| 25 |
apt-get upgrade -y && \
|
| 26 |
+
apt-get install -y curl gnupg lsb-release sudo jq ipcalc && \
|
| 27 |
+
curl https://pkg.cloudflareclient.com/pubkey.gpg | gpg --yes --dearmor --output /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg && \
|
|
|
|
|
|
|
| 28 |
echo "deb [signed-by=/usr/share/keyrings/cloudflare-warp-archive-keyring.gpg] https://pkg.cloudflareclient.com/ $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/cloudflare-client.list && \
|
| 29 |
apt-get update && \
|
| 30 |
apt-get install -y cloudflare-warp && \
|
| 31 |
apt-get clean && \
|
| 32 |
+
apt-get autoremove -y && \
|
| 33 |
+
MAJOR_VERSION=$(echo ${GOST_VERSION} | cut -d. -f1) && \
|
|
|
|
|
|
|
| 34 |
MINOR_VERSION=$(echo ${GOST_VERSION} | cut -d. -f2) && \
|
| 35 |
+
# detect if version >= 2.12.0, which uses new filename syntax
|
| 36 |
+
if [ "${MAJOR_VERSION}" -ge 3 ] || [ "${MAJOR_VERSION}" -eq 2 -a "${MINOR_VERSION}" -ge 12 ]; then \
|
| 37 |
+
NAME_SYNTAX="new" && \
|
| 38 |
+
if [ "${TARGETPLATFORM}" = "linux/arm64" ]; then \
|
| 39 |
+
ARCH="arm64"; \
|
| 40 |
+
fi && \
|
| 41 |
FILE_NAME="gost_${GOST_VERSION}_linux_${ARCH}.tar.gz"; \
|
| 42 |
else \
|
| 43 |
+
NAME_SYNTAX="legacy" && \
|
| 44 |
FILE_NAME="gost-linux-${ARCH}-${GOST_VERSION}.gz"; \
|
| 45 |
fi && \
|
| 46 |
+
echo "File name: ${FILE_NAME}" && \
|
| 47 |
curl -LO https://github.com/ginuerzh/gost/releases/download/v${GOST_VERSION}/${FILE_NAME} && \
|
| 48 |
+
if [ "${NAME_SYNTAX}" = "new" ]; then \
|
| 49 |
tar -xzf ${FILE_NAME} -C /usr/bin/ gost; \
|
| 50 |
else \
|
| 51 |
gunzip ${FILE_NAME} && \
|
| 52 |
mv gost-linux-${ARCH}-${GOST_VERSION} /usr/bin/gost; \
|
| 53 |
fi && \
|
| 54 |
+
chmod +x /usr/bin/gost && \
|
| 55 |
+
chmod +x /entrypoint.sh && \
|
|
|
|
| 56 |
chmod +x /healthcheck/index.sh && \
|
| 57 |
useradd -m -s /bin/bash warp && \
|
| 58 |
echo "warp ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/warp
|
| 59 |
+
|
| 60 |
+
USER warp
|
| 61 |
+
|
| 62 |
+
# Accept Cloudflare WARP TOS
|
| 63 |
+
RUN mkdir -p /home/warp/.local/share/warp && \
|
| 64 |
+
echo -n 'yes' > /home/warp/.local/share/warp/accepted-tos.txt
|
| 65 |
+
|
| 66 |
+
ENV GOST_ARGS="-L :1080"
|
| 67 |
+
ENV WARP_SLEEP=2
|
| 68 |
+
ENV REGISTER_WHEN_MDM_EXISTS=
|
| 69 |
+
ENV WARP_LICENSE_KEY=
|
| 70 |
+
ENV BETA_FIX_HOST_CONNECTIVITY=
|
| 71 |
+
|
| 72 |
+
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 \
|
| 73 |
+
CMD /healthcheck/index.sh
|
| 74 |
+
|
| 75 |
+
ENTRYPOINT ["/entrypoint.sh"]
|