aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-04-25 21:40:00 -0400
committerGalen Guyer <galen@galenguyer.com>2022-04-25 21:40:00 -0400
commit5b3a5a474e51e6ad8b2f1f9e44ebf0fcb96c06e5 (patch)
treeeb4c5a01c963a6f978225729330c309fd35bc036
parent6014afab0fabad2b7213fee67a1dc28257ba48e4 (diff)
add dockerfile
-rw-r--r--.dockerignore2
-rw-r--r--.gitignore2
-rw-r--r--Dockerfile13
-rw-r--r--main.go6
4 files changed, 19 insertions, 4 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..3aa4c44
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,2 @@
+.env*
+clinton
diff --git a/.gitignore b/.gitignore
index 4fdf0f7..3aa4c44 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,2 @@
-.env
+.env*
clinton
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..c22a379
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,13 @@
+FROM docker.io/golang:1.18-alpine3.15 AS build
+
+WORKDIR /src/
+COPY . .
+RUN apk add git && \
+ go build -v -o vote
+
+FROM docker.io/alpine:3.15
+COPY static /static
+COPY templates /templates
+COPY --from=build /src/vote /vote
+
+ENTRYPOINT [ "/vote" ]
diff --git a/main.go b/main.go
index 26866d7..b78de27 100644
--- a/main.go
+++ b/main.go
@@ -27,8 +27,8 @@ func main() {
os.Getenv("VOTE_JWT_SECRET"),
os.Getenv("VOTE_SECRET"),
os.Getenv("VOTE_HOST"),
- os.Getenv("VOTE_HOST")+"auth/callback",
- os.Getenv("VOTE_HOST")+"auth/login",
+ os.Getenv("VOTE_HOST")+"/auth/callback",
+ os.Getenv("VOTE_HOST")+"/auth/login",
[]string{"profile", "email", "groups"},
)
@@ -259,7 +259,7 @@ func main() {
c.Redirect(302, "/results/"+poll.Id)
}))
- r.GET("/stream/:topic", broker.ServeHTTP)
+ r.GET("/stream/:topic", csh.AuthWrapper(broker.ServeHTTP))
go broker.Listen()