diff options
author | Mike Crute <mike@crute.us> | 2023-07-31 15:46:25 -0700 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2023-07-31 15:46:25 -0700 |
commit | d7d77fd1c9035ec6356abb57a5486f0a13029628 (patch) | |
tree | cc9528787aa42171fee791bb69148c346ae4b2d9 | |
parent | cfbb1efaea31c498433db43cb507f54545c724f5 (diff) | |
download | websocket_proxy-d7d77fd1c9035ec6356abb57a5486f0a13029628.tar.bz2 websocket_proxy-d7d77fd1c9035ec6356abb57a5486f0a13029628.tar.xz websocket_proxy-d7d77fd1c9035ec6356abb57a5486f0a13029628.zip |
Make docker build work
-rw-r--r-- | Dockerfile | 11 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | cmd/web/server.go | 4 | ||||
-rw-r--r-- | main.go | 8 |
4 files changed, 23 insertions, 6 deletions
diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d817d70 --- /dev/null +++ b/Dockerfile | |||
@@ -0,0 +1,11 @@ | |||
1 | FROM alpine:latest | ||
2 | LABEL maintainer="Mike Crute <mike@crute.us>" | ||
3 | |||
4 | ENV TZ America/Los_Angeles | ||
5 | |||
6 | RUN set -euxo pipefail; \ | ||
7 | apk --no-cache add tzdata; | ||
8 | |||
9 | ADD ssh-proxy /ssh-proxy | ||
10 | |||
11 | CMD ["/ssh-proxy", "web"] | ||
@@ -2,7 +2,7 @@ IMAGE=docker.crute.me/ssh-proxy | |||
2 | BINARY=ssh-proxy | 2 | BINARY=ssh-proxy |
3 | CLIENT_BINARY=ssh-proxy-client | 3 | CLIENT_BINARY=ssh-proxy-client |
4 | 4 | ||
5 | $(BINARY): $(CLIENT_BINARY) $(shell find . -name '*.go') | 5 | $(BINARY): $(CLIENT_BINARY) $(shell find . -name '*.go' -o -name '*.tpl' -o -name '*.js') |
6 | @[ "$(CLIENT_ID)" ] || ( echo "CLIENT_ID must be set"; exit 1 ) | 6 | @[ "$(CLIENT_ID)" ] || ( echo "CLIENT_ID must be set"; exit 1 ) |
7 | 7 | ||
8 | CGO_ENABLED=0 go build \ | 8 | CGO_ENABLED=0 go build \ |
@@ -26,7 +26,7 @@ vet: main.go | |||
26 | 26 | ||
27 | .PHONY: docker | 27 | .PHONY: docker |
28 | docker: $(BINARY) | 28 | docker: $(BINARY) |
29 | mkdir docker; cp Dockerfile web-server docker; cd docker; \ | 29 | mkdir docker; cp Dockerfile $(BINARY) docker; cd docker; \ |
30 | docker pull $(shell grep '^FROM ' Dockerfile | cut -d' ' -f2); \ | 30 | docker pull $(shell grep '^FROM ' Dockerfile | cut -d' ' -f2); \ |
31 | docker build --no-cache -t $(IMAGE):stage . | 31 | docker build --no-cache -t $(IMAGE):stage . |
32 | 32 | ||
@@ -58,6 +58,6 @@ run-web: clean $(BINARY) | |||
58 | test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID | 58 | test -n "$(VAULT_SECRET_ID)" # Caller must also export VAULT_SECRET_ID |
59 | VAULT_ADDR="https://vault.sea4.crute.me:8200" \ | 59 | VAULT_ADDR="https://vault.sea4.crute.me:8200" \ |
60 | VAULT_SKIP_VERIFY=true \ | 60 | VAULT_SKIP_VERIFY=true \ |
61 | ./$(BINARY) --debug \ | 61 | ./$(BINARY) \ |
62 | --hostname=dev.ssh-proxy.crute.me \ | 62 | --hostname=dev.ssh-proxy.crute.me \ |
63 | web | 63 | web |
diff --git a/cmd/web/server.go b/cmd/web/server.go index 62624e2..83f4fc8 100644 --- a/cmd/web/server.go +++ b/cmd/web/server.go | |||
@@ -148,7 +148,7 @@ func webMain(cfg app.Config, embeddedTemplates, embeddedClients fs.FS, appVersio | |||
148 | RPDisplayName: cfg.OauthRPName, | 148 | RPDisplayName: cfg.OauthRPName, |
149 | RPID: cfg.Hostnames[0], | 149 | RPID: cfg.Hostnames[0], |
150 | RPOrigins: []string{ | 150 | RPOrigins: []string{ |
151 | fmt.Sprintf("https://%s:8070", cfg.Hostnames[0]), // TODO: Expose port in echo server for use here | 151 | fmt.Sprintf("https://%s", cfg.Hostnames[0]), // TODO: Expose port in echo server for use here |
152 | }, | 152 | }, |
153 | }) | 153 | }) |
154 | if err != nil { | 154 | if err != nil { |
@@ -176,7 +176,7 @@ func webMain(cfg app.Config, embeddedTemplates, embeddedClients fs.FS, appVersio | |||
176 | Logger: s.Logger, | 176 | Logger: s.Logger, |
177 | AuthSessions: authSessionStore, | 177 | AuthSessions: authSessionStore, |
178 | OauthClients: oauthClientStore, | 178 | OauthClients: oauthClientStore, |
179 | Hostname: fmt.Sprintf("https://%s:8070", cfg.Hostnames[0]), // TODO | 179 | Hostname: fmt.Sprintf("https://%s", cfg.Hostnames[0]), // TODO |
180 | PollSeconds: cfg.OauthDevicePollSecs, | 180 | PollSeconds: cfg.OauthDevicePollSecs, |
181 | SessionExpiration: cfg.OauthSessionTimeout, | 181 | SessionExpiration: cfg.OauthSessionTimeout, |
182 | } | 182 | } |
@@ -4,6 +4,7 @@ package main | |||
4 | 4 | ||
5 | import ( | 5 | import ( |
6 | "embed" | 6 | "embed" |
7 | "io/fs" | ||
7 | "log" | 8 | "log" |
8 | 9 | ||
9 | "code.crute.us/mcrute/ssh-proxy/app" | 10 | "code.crute.us/mcrute/ssh-proxy/app" |
@@ -35,7 +36,12 @@ func main() { | |||
35 | } | 36 | } |
36 | cli.AddFlags(rootCmd, &app.Config{}, app.DefaultConfig, "") | 37 | cli.AddFlags(rootCmd, &app.Config{}, app.DefaultConfig, "") |
37 | 38 | ||
38 | web.Register(rootCmd, embeddedTemplates, embeddedClients, appVersion) | 39 | templates, err := fs.Sub(embeddedTemplates, "templates") |
40 | if err != nil { | ||
41 | log.Fatalf("Error building sub-fs of embeded fs") | ||
42 | } | ||
43 | |||
44 | web.Register(rootCmd, templates, embeddedClients, appVersion) | ||
39 | client.Register(rootCmd) | 45 | client.Register(rootCmd) |
40 | register.Register(rootCmd) | 46 | register.Register(rootCmd) |
41 | 47 | ||