chore: dockerfile

This commit is contained in:
mzz2017 committed 2021-08-09 23:34:20 +08:00
1 parent 9cbcfe9d05
commit 32891ec68d
3 files changed
+14 -15

No files matched your search

+3 -3
View File
@@ -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
+10 -10
View File
@@ -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"]
+1 -2
View File
@@ -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 {