CliProxyApiServer / Dockerfile
DanielleNguyen's picture
Update Dockerfile
a477cf0 verified
Raw
History Blame Contribute Delete
1.62 kB
FROM debian:bookworm-slim
ARG CLIPROXYAPI_REPO=router-for-me/CLIProxyAPI
ENV APP_HOME=/opt/cli-proxy-api \
DATA_DIR=/data \
HOME=/data \
TZ=Asia/Shanghai
RUN apt-get update && \
apt-get install -y --no-install-recommends ca-certificates curl tar tzdata && \
rm -rf /var/lib/apt/lists/*
RUN mkdir -p "$APP_HOME" "$DATA_DIR"
RUN set -eux; \
latest_url="$(curl -fsSLI -o /dev/null -w '%{url_effective}' "https://github.com/${CLIPROXYAPI_REPO}/releases/latest")"; \
tag="${latest_url##*/}"; \
version="${tag#v}"; \
asset="CLIProxyAPI_${version}_linux_amd64.tar.gz"; \
asset_url="https://github.com/${CLIPROXYAPI_REPO}/releases/download/${tag}/${asset}"; \
checksums_url="https://github.com/${CLIPROXYAPI_REPO}/releases/download/${tag}/checksums.txt"; \
curl -fsSL "$checksums_url" -o /tmp/checksums.txt; \
curl -fsSL "$asset_url" -o /tmp/cli-proxy-api.tar.gz; \
expected_sha="$(grep " ${asset}$" /tmp/checksums.txt | awk '{print $1}')"; \
test -n "$expected_sha"; \
echo "$expected_sha /tmp/cli-proxy-api.tar.gz" | sha256sum -c -; \
tar -xzf /tmp/cli-proxy-api.tar.gz -C "$APP_HOME"; \
if [ -f "$APP_HOME/CLIProxyAPI" ]; then mv "$APP_HOME/CLIProxyAPI" "$APP_HOME/cli-proxy-api"; fi; \
test -f "$APP_HOME/cli-proxy-api"; \
chmod +x "$APP_HOME/cli-proxy-api"; \
rm -f /tmp/checksums.txt /tmp/cli-proxy-api.tar.gz
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh && \
ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime && \
echo "${TZ}" > /etc/timezone
WORKDIR /data
EXPOSE 8317
ENTRYPOINT ["/entrypoint.sh"]