File tree 3 files changed +50
-5
lines changed
3 files changed +50
-5
lines changed Original file line number Diff line number Diff line change 8
8
builds :
9
9
- goos : [linux, freebsd, windows, darwin]
10
10
goarch : [amd64, arm64]
11
+ env :
12
+ - CGO_ENABLED=0
11
13
ignore :
12
14
- goos : freebsd
13
15
goarch : arm64
@@ -22,6 +24,15 @@ archive:
22
24
windows : win
23
25
amd64 : 64-bit
24
26
27
+ dockers :
28
+ - binary : http-over-ssh
29
+ goos : linux
30
+ goarch : amd64
31
+ image_templates :
32
+ - " digineo/http-over-ssh:latest"
33
+ - " digineo/http-over-ssh:{{ .Version }}"
34
+ skip_push : true
35
+
25
36
release :
26
37
prerelease : auto
27
38
Original file line number Diff line number Diff line change
1
+ FROM alpine:latest
2
+
3
+ RUN apk --no-cache add tzdata ca-certificates \
4
+ && mkdir /data
5
+
6
+ COPY http-over-ssh /
7
+
8
+ ENV ZONEINFO /zoneinfo.zip
9
+ ENV HOS_USER root
10
+ ENV HOS_TIMEOUT 10s
11
+ ENV HOS_KEY_DIR /data
12
+ ENV HOS_LISTEN :8080
13
+ EXPOSE 8080
14
+
15
+ WORKDIR /data
16
+ ENTRYPOINT ["/http-over-ssh" ]
17
+
Original file line number Diff line number Diff line change @@ -22,16 +22,26 @@ var home = func() string {
22
22
return os .Getenv ("HOME" )
23
23
}()
24
24
25
+ var sshKeyDir = or (os .Getenv ("HOS_KEY_DIR" ), filepath .Join (home , ".ssh" ))
26
+
25
27
var sshKeys = []string {
26
- filepath .Join (home , ".ssh/ id_rsa" ),
27
- filepath .Join (home , ".ssh/ id_ed25519" ),
28
+ filepath .Join (sshKeyDir , "id_rsa" ),
29
+ filepath .Join (sshKeyDir , "id_ed25519" ),
28
30
}
29
31
30
32
// command line flags
31
33
var (
32
- listen = "[::1]:8080"
33
- sshUser = "root"
34
- sshTimeout = 10 * time .Second
34
+ listen = or (os .Getenv ("HOS_LISTEN" ), "[::1]:8080" )
35
+ sshUser = or (os .Getenv ("HOS_USER" ), "root" )
36
+ sshTimeout = func () time.Duration {
37
+ dur := os .Getenv ("HOS_TIMEOUT" )
38
+ if dur != "" {
39
+ if d , err := time .ParseDuration (dur ); err != nil {
40
+ return d
41
+ }
42
+ }
43
+ return 10 * time .Second
44
+ }()
35
45
)
36
46
37
47
// build flags
@@ -75,3 +85,10 @@ func main() {
75
85
76
86
log .Fatal (http .Serve (listener , proxy ))
77
87
}
88
+
89
+ func or (s , alt string ) string {
90
+ if s != "" {
91
+ return s
92
+ }
93
+ return alt
94
+ }
You can’t perform that action at this time.
0 commit comments