Create Dockerfile
Browse files- Dockerfile +62 -0
Dockerfile
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:22.04
|
| 2 |
+
RUN apt install git -y
|
| 3 |
+
RUN git clone https://github.com/UrloMythus/warp-docker.git
|
| 4 |
+
ARG WARP_VERSION
|
| 5 |
+
ARG GOST_VERSION
|
| 6 |
+
ARG COMMIT_SHA
|
| 7 |
+
ARG TARGETPLATFORM="linux/amd64"
|
| 8 |
+
|
| 9 |
+
LABEL org.opencontainers.image.authors="cmj2002"
|
| 10 |
+
LABEL org.opencontainers.image.url="https://github.com/cmj2002/warp-docker"
|
| 11 |
+
LABEL WARP_VERSION=${WARP_VERSION}
|
| 12 |
+
LABEL GOST_VERSION=${GOST_VERSION}
|
| 13 |
+
LABEL COMMIT_SHA=${COMMIT_SHA}
|
| 14 |
+
|
| 15 |
+
COPY entrypoint.sh /entrypoint.sh
|
| 16 |
+
COPY ./healthcheck /healthcheck
|
| 17 |
+
|
| 18 |
+
RUN set -ex && \
|
| 19 |
+
echo "Building for TARGETPLATFORM: ${TARGETPLATFORM}" && \
|
| 20 |
+
# Determine ARCH based on TARGETPLATFORM
|
| 21 |
+
case ${TARGETPLATFORM} in \
|
| 22 |
+
"linux/amd64") ARCH="amd64" ;; \
|
| 23 |
+
"linux/arm64") ARCH="arm64" ;; \
|
| 24 |
+
*) echo "Unsupported TARGETPLATFORM: ${TARGETPLATFORM}" && exit 1 ;; \
|
| 25 |
+
esac && \
|
| 26 |
+
echo "Architecture set to: ${ARCH}"
|
| 27 |
+
|
| 28 |
+
# Install dependencies
|
| 29 |
+
RUN apt-get update && \
|
| 30 |
+
apt-get upgrade -y && \
|
| 31 |
+
apt-get install -y curl gnupg lsb-release sudo jq ipcalc
|
| 32 |
+
|
| 33 |
+
# Add Cloudflare WARP repository
|
| 34 |
+
RUN curl -fsSL https://pkg.cloudflareclient.com/pubkey.gpg | gpg --dearmor -o /usr/share/keyrings/cloudflare-warp-archive-keyring.gpg && \
|
| 35 |
+
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 && \
|
| 36 |
+
apt-get update && \
|
| 37 |
+
apt-get install -y cloudflare-warp && \
|
| 38 |
+
apt-get clean && \
|
| 39 |
+
apt-get autoremove -y
|
| 40 |
+
|
| 41 |
+
# Determine GOST file naming convention and download
|
| 42 |
+
RUN MAJOR_VERSION=$(echo ${GOST_VERSION} | cut -d. -f1) && \
|
| 43 |
+
MINOR_VERSION=$(echo ${GOST_VERSION} | cut -d. -f2) && \
|
| 44 |
+
if [ "${MAJOR_VERSION}" -ge 3 ] || { [ "${MAJOR_VERSION}" -eq 2 ] && [ "${MINOR_VERSION}" -ge 12 ]; }; then \
|
| 45 |
+
FILE_NAME="gost_${GOST_VERSION}_linux_${ARCH}.tar.gz"; \
|
| 46 |
+
else \
|
| 47 |
+
FILE_NAME="gost-linux-${ARCH}-${GOST_VERSION}.gz"; \
|
| 48 |
+
fi && \
|
| 49 |
+
echo "Downloading GOST file: ${FILE_NAME}" && \
|
| 50 |
+
curl -LO https://github.com/ginuerzh/gost/releases/download/v${GOST_VERSION}/${FILE_NAME} && \
|
| 51 |
+
if [ "${FILE_NAME##*.}" = "tar.gz" ]; then \
|
| 52 |
+
tar -xzf ${FILE_NAME} -C /usr/bin/ gost; \
|
| 53 |
+
else \
|
| 54 |
+
gunzip ${FILE_NAME} && \
|
| 55 |
+
mv gost-linux-${ARCH}-${GOST_VERSION} /usr/bin/gost; \
|
| 56 |
+
fi && \
|
| 57 |
+
chmod +x /usr/bin/gost
|
| 58 |
+
|
| 59 |
+
RUN chmod +x /entrypoint.sh && \
|
| 60 |
+
chmod +x /healthcheck/index.sh && \
|
| 61 |
+
useradd -m -s /bin/bash warp && \
|
| 62 |
+
echo "warp ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/warp
|