yemingfeng hai 2 meses
pai
achega
5ec32c368b
Modificáronse 4 ficheiros con 15 adicións e 51 borrados
  1. 14 8
      Dockerfile
  2. 1 0
      internal/server/server.go
  3. 0 9
      scripts/docker-node.sh
  4. 0 34
      scripts/slave.sh

+ 14 - 8
Dockerfile

@@ -1,10 +1,16 @@
-FROM golang:1.21rc2
+FROM ubuntu:24.04
 
-WORKDIR app
-
-COPY . .
-
-RUN chmod a+x openvpn-install.sh
-
-RUN bash ./openvpn-install.sh
+# 设置环境变量
+ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
 
+# 安装 Go 和其他必要的工具
+RUN apt-get update && \
+    apt-get install -y \
+        wget \
+        git \
+        build-essential && \
+    wget https://golang.org/dl/go1.20.linux-amd64.tar.gz && \
+    tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz && \
+    rm go1.20.linux-amd64.tar.gz && \
+    echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile && \
+    /bin/bash -c "source /etc/profile"

+ 1 - 0
internal/server/server.go

@@ -237,6 +237,7 @@ func convert2DtoNode(node *model.Node, host string) *dto.Node {
 		"SG": "asia",
 		"US": "northam",
 		"ZA": "southam",
+		"NL": "eu",
 	}
 
 	countryLabel := fmt.Sprintf("%s", countryLabels[node.CountryCode])

+ 0 - 9
scripts/docker-node.sh

@@ -1,9 +0,0 @@
-# run openvpn
-docker run -it --rm --cap-add=NET_ADMIN \
-  -p 1194:1194/udp \
-  -p 80:8080/tcp \
-  -e HOST_ADDR=$(curl -s https://api.ipify.org) \
-  -v /home/ubuntu/openvpn_config:/opt/Dockovpn_data \
-  --name dockovpn alekslitvinenk/openvpn -r
-
-# run slave-server

+ 0 - 34
scripts/slave.sh

@@ -1,34 +0,0 @@
-#!/bin/bash
-yum update -y
-
-ssh-keygen -q -t rsa -N '' -f ~/.ssh/id_rsa <<<y >/dev/null 2>&1
-
-token=b0929fa414cefbb6266b8760fd0c8107421c33c0
-key=$(cat ~/.ssh/id_rsa.pub)
-echo $key
-now=$(date +%Y-%m-%dT%H:%M:%S.%N)
-echo $now
-
-curl -H "Authorization: token $token" -XPOST http://hubgit.cn/api/v1/user/keys -H 'content-type: application/json' -d"{\"title\":\"slave$now\", \"key\": \"$key\"}"
-
-rm -rf /var/run/yum.pid
-yum install git -y
-
-# clone project
-ssh-keygen -F hubgit.cn || ssh-keyscan hubgit.cn >>~/.ssh/known_hosts
-git clone root@hubgit.cn:ben/be-vpn.git
-cd be-vpn
-
-# install openvpn
-chmod +x ./scripts/openvpn-install.sh
-export AUTO_INSTALL=y && ./scripts/openvpn-install.sh
-
-# install golang
-rm -rf /var/run/yum.pid
-yum install golang -y
-export HOME=/root
-export GOPATH=$HOME/go
-export PATH=$PATH:$GOPATH/bin
-go env -w GOMODCACHE=/go/pkg
-go build ./cmd/slave.go
-nohup ./slave &