Skip to content

Commit

Permalink
xray dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Dec 9, 2020
1 parent c5c810f commit 410cb2b
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions docker/xray/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM centos:latest as builder

RUN curl -L -s https://multi.netlify.app/go.sh -o go.sh && bash go.sh -x

FROM alpine:latest

LABEL maintainer "Jrohy <[email protected]>"

ENV COMPLETION_FILE "/usr/share/bash-completion/completions/xray"

ENV SOURCE_COMPLETION_FILE "https://multi.netlify.app/v2ray"

ENV VERSION_LIST "https://api.github.com/repos/Jrohy/multi-v2ray/tags"

COPY --from=builder /usr/bin/xray/xray /usr/bin/xray/
COPY --from=builder /usr/bin/xray/geoip.dat /usr/bin/xray/
COPY --from=builder /usr/bin/xray/geosite.dat /usr/bin/xray/
COPY run.sh /root

WORKDIR /root

RUN apk --no-cache add python3 bash bash-completion ca-certificates curl socat openssl iptables ip6tables && \
python3 -m ensurepip && \
rm -r /usr/lib/python*/ensurepip && \
pip3 install --upgrade pip setuptools && \
LATEST_VERSION=`curl -s $VERSION_LIST|grep name|grep -o "[0-9].*[0-9]"|head -n 1` && \
pip install v2ray-util==$LATEST_VERSION && \
curl $SOURCE_COMPLETION_FILE > $COMPLETION_FILE && \
sed -i 's/v2ray/xray/g' $COMPLETION_FILE && \
mkdir /var/log/xray/ && \
chmod +x /usr/bin/xray/xray && \
chmod +x /root/run.sh && \
chmod +x $COMPLETION_FILE && \
echo "source $COMPLETION_FILE" > /root/.bashrc && \
ln -s $(which v2ray-util) /usr/local/bin/xray && \
rm -r /root/.cache

ENTRYPOINT ["./run.sh"]
11 changes: 11 additions & 0 deletions docker/xray/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

if [[ ! -e /etc/xray ]];then
mkdir /etc/xray
xray new >/dev/null 2>&1
fi

touch /.run.log
/usr/bin/xray/xray -config=/etc/xray/config.json > /.run.log &

tail -f /.run.log

0 comments on commit 410cb2b

Please sign in to comment.