Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward request and error logs to docker log collector #51

Merged
merged 1 commit into from
Jan 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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