Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

add docker file En version #184

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
12 changes: 12 additions & 0 deletions Docker_EN/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM debian:11-slim
WORKDIR /root
COPY en.sh /root/en.sh
RUN apt-get update && apt-get install -y --no-install-recommends -y systemctl curl bash v2ray gzip wget ca-certificates \
&& apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN systemctl start v2ray
RUN bash /root/en.sh
WORKDIR /root


VOLUME [ "/etc/x-ui" ]
CMD [ "/root/x-ui/x-ui" ]
47 changes: 47 additions & 0 deletions Docker_EN/en.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
plain='\033[0m'

cur_dir=$(pwd)

arch=$(arch)
last_version=${last_version}

if [[ $arch == "x86_64" || $arch == "x64" || $arch == "amd64" ]]; then
arch="amd64"
elif [[ $arch == "aarch64" || $arch == "arm64" ]]; then
arch="arm64"
else
arch="amd64"
echo -e "${red}fail to check system arch,will use default arch here: ${arch}${plain}"
fi

if [ $# == 0 ]; then
last_version=$(curl -Ls "https://api.github.com/repos/FranzKafkaYu/x-ui/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [[ ! -n "$last_version" ]]; then
echo -e "${red}refresh x-ui version failed,it may due to Github API restriction,please try it later${plain}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correcting grammar:

echo -e "${red}refresh x-ui version failed, it might be due to GitHub API restriction, please again later${plain}"

exit 1
fi
echo -e "get x-ui latest version succeed:${last_version},begin to install..."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change from:

echo -e "get x-ui latest version succeed:${last_version},begin to install..."

to:

echo -e "getting x-ui latest version succeed:${last_version},begin to install..."

wget -N --no-check-certificate -O /root/x-ui-linux-${arch}-english.tar.gz https://github.com/FranzKafkaYu/x-ui/releases/download/${last_version}/x-ui-linux-${arch}-english.tar.gz
if [[ $? -ne 0 ]]; then
echo -e "${red}dowanload x-ui failed,please be sure that your server can access Github{plain}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct spelling and grammar.
Change from:

echo -e "${red}dowanload x-ui failed,please be sure that your server can access Github{plain}"

to:

echo -e "${red}downloading x-ui failed, please make sure that your server can access GitHub{plain}"

exit 1
fi
else
last_version=$1
url="https://github.com/FranzKafkaYu/x-ui/releases/download/${last_version}/x-ui-linux-${arch}-english.tar.gz"
echo -e "begin to install x-ui v$1 ..."
wget -N --no-check-certificate -O /root/x-ui-linux-${arch}-english.tar.gz ${url}
if [[ $? -ne 0 ]]; then
echo -e "${red}dowanload x-ui v$1 failed,please check the verison exists${plain}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spelling issues

  • change dowanload to download.
  • change verison to version.
  • Correcting grammar.

from:

echo -e "${red}dowanload x-ui v$1 failed,please check the verison exists${plain}"

to:

echo -e "${red}downloading x-ui v$1 failed,please check exciting version${plain}"

exit 1
fi
fi


tar zxvf x-ui-linux-${arch}-english.tar.gz
rm x-ui-linux-${arch}-english.tar.gz -f

6 changes: 6 additions & 0 deletions Docker_EN/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker build -t xui:latest .
docker run -itd --network=host \
-v $PWD/db/:/etc/x-ui/ \
-v $PWD/cert/:/root/cert/ \
--name x-ui --restart=unless-stopped \
xui:latest