mirror of
https://github.com/ICKelin/opennotr.git
synced 2025-09-26 20:01:13 +08:00
ci: add docker files
This commit is contained in:
12
build.sh
12
build.sh
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
WORKSPACE=`pwd`
|
||||
BIN=$WORKSPACE/bin/
|
||||
|
||||
cd $WORKSPACE/opennotr
|
||||
GOOS=darwin go build -o $BIN/opennotr-client_darwin_amd64
|
||||
GOOS=linux go build -o $BIN/opennotr-client_linux_amd64
|
||||
GOARCH=arm GOOS=linux go build -o $BIN/opennotr-client_arm
|
||||
GOARCH=arm64 GOOS=linux go build -o $BIN/opennotr-client_arm64
|
||||
|
||||
cd $WORKSPACE/opennotrd
|
||||
GOOS=linux go build -o $BIN/opennotr-server_linux
|
17
build_exec.sh
Normal file
17
build_exec.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
WORKSPACE=`pwd`
|
||||
BIN=$WORKSPACE/bin/
|
||||
EXEC_PREFIX=opennotrd
|
||||
|
||||
cd $WORKSPACE/opennotr
|
||||
export GO111MODULE = on
|
||||
|
||||
echo 'building client...'
|
||||
GOOS=darwin go build -o $BIN/$EXEC_PREFIX-client_darwin_amd64
|
||||
GOOS=linux go build -o $BIN/$EXEC_PREFIX-client_linux_amd64
|
||||
GOARCH=arm GOOS=linux go build -o $BIN/$EXEC_PREFIX-client_arm
|
||||
GOARCH=arm64 GOOS=linux go build -o $BIN/$EXEC_PREFIX-client_arm64
|
||||
|
||||
echo 'building server...'
|
||||
cd $WORKSPACE/opennotrd
|
||||
GOOS=linux go build -o $BIN/$EXEC_PREFIX-server_linux_amd64
|
6
build_image.sh
Normal file
6
build_image.sh
Normal file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
WORKSPACE=`pwd`
|
||||
cd opennotrd && go build -o ../docker-build/opennotrd
|
||||
|
||||
cd $WORKSPACE/docker-build
|
||||
docker build . -t opennotr
|
5
docker-build/Dockerfile
Normal file
5
docker-build/Dockerfile
Normal file
@@ -0,0 +1,5 @@
|
||||
FROM ickelin/resty-upstream:latest
|
||||
COPY opennotrd /opt/
|
||||
COPY start.sh /opt/
|
||||
RUN chmod +x /opt/start.sh && chmod +x /opt/opennotrd
|
||||
CMD /opt/start.sh
|
13
docker-build/docker-compose.yaml
Normal file
13
docker-build/docker-compose.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
version: '3'
|
||||
services:
|
||||
opennotrd:
|
||||
image: ickelin/opennotr:latest
|
||||
network_mode: host
|
||||
container_name: opennotrd
|
||||
restart: always
|
||||
privileged: true
|
||||
volumes:
|
||||
- /opt/logs/opennotr:/opt/resty-upstream/logs
|
||||
- /opt/data/opennotrd:/opt/conf
|
||||
environment:
|
||||
TIME_ZONE: Asia/Shanghai
|
3
docker-build/start.sh
Normal file
3
docker-build/start.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
/opt/openresty/bin/openresty -p /opt/resty-upstream -c /opt/conf/nginx-conf/nginx.conf
|
||||
/opt/opennotrd -conf /opt/conf/notrd.yaml
|
@@ -5,4 +5,6 @@ http: 8080
|
||||
https: 8080
|
||||
grpc: 50052
|
||||
tcp:
|
||||
2222: 22
|
||||
2222: 22
|
||||
udp:
|
||||
53: 53
|
@@ -150,6 +150,7 @@ func (p *UDPProxy) udpCopy(src, dst *net.UDPConn, toaddr *net.UDPAddr) {
|
||||
logs.Error("read from udp fail: %v", err)
|
||||
break
|
||||
}
|
||||
|
||||
logs.Debug("write back to client %d bytes", nr)
|
||||
_, err = dst.WriteToUDP(buf[:nr], toaddr)
|
||||
if err != nil {
|
||||
|
@@ -74,7 +74,7 @@ func (p *UpstreamManager) DelUpstream(host string, httpPort, httpsPort, grpcPort
|
||||
}
|
||||
|
||||
if grpcPort != 0 {
|
||||
p.sendDeleteReq(host, "http2")
|
||||
p.sendDeleteReq(host, "h2c")
|
||||
}
|
||||
}
|
||||
|
||||
|
0
run_image.sh
Normal file
0
run_image.sh
Normal file
Reference in New Issue
Block a user