diff --git a/.travis.yml b/.travis.yml index cb545b2a..cdbe8f9e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,13 +37,13 @@ install: - gem install fpm -v 1.13.1 script: - yarn --cwd $P_DIR/gui && yarn --cwd $P_DIR/gui build - - cd $P_DIR - - tar -zcvf web.tar.gz web/ - - cp -r web $P_DIR/service/server/router/ + - cp -r $P_DIR/web $P_DIR/service/server/router/ - cd $P_DIR/service && CGO_ENABLED=0 gox -ldflags '-extldflags "-static"' -osarch="linux/386 linux/amd64 linux/arm linux/arm64" -ldflags="-X github.com/v2rayA/v2rayA/global.Version=${VERSION:1} -s -w" -output="$P_DIR/v2raya_{{.OS}}_{{.Arch}}_$VERSION" - mv $P_DIR/v2raya_linux_386_$VERSION $P_DIR/v2raya_linux_x86_$VERSION && mv $P_DIR/v2raya_linux_amd64_$VERSION $P_DIR/v2raya_linux_x64_$VERSION - files="install/universal/v2raya.service=/etc/systemd/system/v2raya.service install/universal/v2raya.png=/usr/share/icons/hicolor/512x512/apps/v2raya.png install/universal/v2raya.desktop=/usr/share/applications/v2raya.desktop" - params="--verbose -f -n $NAME -v ${VERSION:1} --url https://github.com/v2rayA/v2raya --maintainer v2rayA --after-install install/universal/after_install.sh --after-upgrade $P_DIR/install/universal/after_upgrade.sh --before-remove $P_DIR/install/universal/before_remove.sh --after-remove $P_DIR/install/universal/after_remove.sh" + - cd $P_DIR + - tar -zcvf web.tar.gz web/ - fpm -s dir -t deb -p installer_debian_x86_$VERSION.deb --description "$DESC" $params --architecture i386 v2raya_linux_x86_$VERSION=/usr/bin/v2raya $files - fpm -s dir -t deb -p installer_debian_x64_$VERSION.deb --description "$DESC" $params --architecture=amd64 v2raya_linux_x64_$VERSION=/usr/bin/v2raya $files - fpm -s dir -t deb -p installer_debian_armel_$VERSION.deb --description "$DESC" $params --architecture=armel v2raya_linux_arm_$VERSION=/usr/bin/v2raya $files diff --git a/Dockerfile b/Dockerfile index cc150608..a63a3b0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,14 +4,6 @@ ADD .git ./.git RUN git describe --abbrev=0 --tags > ./version -FROM golang:alpine AS builder -ADD service /build/service -WORKDIR /build/service -ENV GO111MODULE=on -ENV GOPROXY=https://goproxy.io -COPY --from=version /build/version ./ -RUN export VERSION=$(cat ./version) && CGO_ENABLED=0 go build -ldflags="-X github.com/v2rayA/v2rayA/global.Version=${VERSION:1} -s -w" -o v2raya . - FROM node:lts-alpine AS builder-web ADD gui /build/gui WORKDIR /build/gui @@ -20,12 +12,20 @@ RUN echo "network-timeout 600000" >> .yarnrc #RUN yarn config set sass_binary_site https://cdn.npm.taobao.org/dist/node-sass -g RUN yarn cache clean && yarn && yarn build +FROM golang:alpine AS builder +ADD service /build/service +WORKDIR /build/service +ENV GO111MODULE=on +ENV GOPROXY=https://goproxy.io +COPY --from=version /build/version ./ +COPY --from=builder-web /build/web server/router/ +RUN export VERSION=$(cat ./version) && go mod tidy && CGO_ENABLED=0 go build -ldflags="-X github.com/v2rayA/v2rayA/global.Version=${VERSION:1} -s -w" -o v2raya . + FROM v2fly/v2fly-core COPY --from=builder /build/service/v2raya /usr/bin/ -COPY --from=builder-web /build/web /etc/v2raya-web RUN wget -O /usr/local/share/v2ray/LoyalsoldierSite.dat https://raw.githubusercontent.com/mzz2017/dist-v2ray-rules-dat/master/geosite.dat RUN apk add --no-cache iptables ip6tables EXPOSE 2017 VOLUME /etc/v2raya -ENTRYPOINT ["v2raya","--mode=universal", "--webdir=/etc/v2raya-web"] +ENTRYPOINT ["v2raya"] diff --git a/service/server/router/index.go b/service/server/router/index.go index cd3b2ec9..6354d480 100644 --- a/service/server/router/index.go +++ b/service/server/router/index.go @@ -73,8 +73,7 @@ func ServeGUI(engine *gin.Engine) { ctx.Header("Content-Type", "text/html; charset=utf-8") ctx.String(http.StatusOK, string(b)) }) - } - if webDir != "" { + } else { if _, err := os.Stat(webDir); os.IsNotExist(err) { log.Printf("[Warning] web files cannot be found at %v. web UI cannot be served", webDir) } else {