Skip to content

Commit

Permalink
Dockerfile: Forward request and error logs to docker log collector (#51)
Browse files Browse the repository at this point in the history
v2ray.sh: Add error output, Normative variable names
  • Loading branch information
OnqiauJliu authored Jan 6, 2023
1 parent efaa50e commit 3dfcde1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ ARG TAG
COPY v2ray.sh /root/v2ray.sh

RUN set -ex \
&& apk add --no-cache tzdata openssl ca-certificates \
&& mkdir -p /etc/v2ray /usr/local/share/v2ray /var/log/v2ray \
&& chmod +x /root/v2ray.sh \
&& /root/v2ray.sh "${TARGETPLATFORM}" "${TAG}"
&& apk add --no-cache tzdata openssl ca-certificates \
&& mkdir -p /etc/v2ray /usr/local/share/v2ray /var/log/v2ray \
# forward request and error logs to docker log collector
&& ln -sf /dev/stdout /var/log/v2ray/access.log \
&& ln -sf /dev/stderr /var/log/v2ray/error.log \
&& chmod +x /root/v2ray.sh \
&& /root/v2ray.sh "${TARGETPLATFORM}" "${TAG}"

ENTRYPOINT ["/usr/bin/v2ray"]
ENTRYPOINT ["/usr/bin/v2ray"]
8 changes: 5 additions & 3 deletions v2ray.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,14 @@ fi
echo "Download binary file: ${V2RAY_FILE} ${DGST_FILE} completed"

# Check SHA512
LOCAL=$(openssl dgst -sha512 v2ray.zip | sed 's/([^)]*)//g')
STR=$(cat v2ray.zip.dgst | grep 'SHA512' | head -n1)
V2RAY_ZIP_HASH=$(openssl dgst -sha512 v2ray.zip | sed 's/([^)]*)//g')
V2RAY_ZIP_DGST_HASH=$(cat v2ray.zip.dgst | grep 'SHA512' | head -n1)

if [ "${LOCAL}" = "${STR}" ]; then
if [ "${V2RAY_ZIP_HASH}" = "${V2RAY_ZIP_DGST_HASH}" ]; then
echo " Check passed" && rm -fv v2ray.zip.dgst
else
echo "V2RAY_ZIP_HASH: ${V2RAY_ZIP_HASH}"
echo "V2RAY_ZIP_DGST_HASH: ${V2RAY_ZIP_DGST_HASH}"
echo " Check have not passed yet " && exit 1
fi

Expand Down

0 comments on commit 3dfcde1

Please sign in to comment.