File tree 6 files changed +28
-5
lines changed
6 files changed +28
-5
lines changed Original file line number Diff line number Diff line change
1
+ ui /node_modules /
Original file line number Diff line number Diff line change
1
+ FROM alpine:3.7
2
+
3
+ COPY api/api /api
4
+ COPY ui/build /ui/build
5
+
6
+ RUN chmod +x /api
7
+
8
+ CMD ["/api" ]
Original file line number Diff line number Diff line change
1
+ REGISTRY ="registry.digitalocean.com/studentelwin"
2
+
3
+ build-ui :
4
+ cd ui; npm run build;
5
+
6
+ build-api :
7
+ cd api; GOOS=linux GOARCH=amd64 go build;
8
+
9
+ publish : build-api build-ui
10
+ docker build . -t chat
11
+ docker tag chat $(REGISTRY ) /chat
12
+ docker push $(REGISTRY ) /chat
Original file line number Diff line number Diff line change
1
+ api
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
29
29
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a /go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY =
30
30
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 /go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY =
31
31
golang.org/x/sys v0.0.0-20190412213103-97732733099d /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
32
+ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ =
32
33
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a /go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs =
33
34
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg =
34
35
golang.org/x/text v0.3.0 /go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ =
Original file line number Diff line number Diff line change @@ -19,11 +19,11 @@ func main() {
19
19
e := echo .New ()
20
20
e .Use (middleware .Logger ())
21
21
22
- e .GET ("/" , func ( c echo. Context ) error {
23
- return c . JSON ( http . StatusOK , "ok" )
24
- } )
22
+ e .Static ("/" , "/ui/build" )
23
+
24
+ api := e . Group ( "/api" )
25
25
26
- e .GET ("/ws" , func (c echo.Context ) error {
26
+ api .GET ("/ws" , func (c echo.Context ) error {
27
27
upgrader := websocket.Upgrader {
28
28
CheckOrigin : func (r * http.Request ) bool { return true },
29
29
}
@@ -47,7 +47,7 @@ func main() {
47
47
return nil
48
48
})
49
49
50
- e .GET ("/users" , func (c echo.Context ) error {
50
+ api .GET ("/users" , func (c echo.Context ) error {
51
51
return c .JSONPretty (http .StatusOK , users , " " )
52
52
})
53
53
You can’t perform that action at this time.
0 commit comments