File tree Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Expand file tree Collapse file tree 3 files changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -17,12 +17,14 @@ ADD ./go.mod ./go.sum /build/
17
17
RUN go mod download
18
18
19
19
COPY . .
20
- COPY --from=builder-frontend /build/dist/* ./public/
21
20
22
21
RUN go build -trimpath -ldflags "-s -w" -o /build/bin/rm-schedule
23
22
24
23
FROM alpine:3.14
25
24
25
+ WORKDIR /app
26
+
27
+ COPY --from=builder-frontend /build/dist /app/public
26
28
COPY --from=builder-backend /build/bin/rm-schedule /bin/rm-schedule
27
29
28
30
ENTRYPOINT ["/bin/rm-schedule" ]
Original file line number Diff line number Diff line change 1
1
package router
2
2
3
3
import (
4
- "embed"
5
-
6
4
"github.com/kataras/iris/v12"
7
5
"github.com/scutrobotlab/rm-schedule/internal/handler"
8
6
)
9
7
10
8
// Router defines the router for this service
11
- func Router (r * iris.Application , frontend embed. FS ) {
9
+ func Router (r * iris.Application , frontend string ) {
12
10
api := r .Party ("/api" )
13
11
api .Get ("/schedule" , handler .ScheduleHandler )
14
12
api .Get ("/group_rank_info" , handler .GroupRankInfoHandler )
15
13
api .Get ("/static/*path" , handler .RMStaticHandler )
16
14
api .Get ("/mp/match" , handler .MpMatchHandler )
17
15
api .Get ("/rank" , handler .RankListHandler )
18
16
19
- r .HandleDir ("/" , frontend , iris.DirOptions {
17
+ r .HandleDir ("/" , iris . Dir ( frontend ) , iris.DirOptions {
20
18
IndexName : "index.html" ,
21
19
ShowList : false ,
22
20
Compress : true ,
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
- "embed"
5
-
6
4
"github.com/kataras/iris/v12"
7
5
"github.com/scutrobotlab/rm-schedule/internal/job"
8
6
"github.com/scutrobotlab/rm-schedule/internal/router"
9
7
)
10
8
11
- //go:embed public/*
12
- var frontend embed.FS
13
-
14
9
func main () {
15
10
cron := job .InitCronJob ()
16
11
cron .Start ()
17
12
defer cron .Stop ()
18
13
19
14
r := iris .Default ()
20
- router .Router (r , frontend )
15
+ router .Router (r , "./public" )
21
16
22
17
if err := r .Listen (":8080" ); err != nil {
23
18
panic (err )
You can’t perform that action at this time.
0 commit comments