Skip to content

Commit

Permalink
Merge pull request #7 from KusionStack/aliyun_deploy
Browse files Browse the repository at this point in the history
Aliyun deploy
  • Loading branch information
Peefy authored Feb 10, 2023
2 parents e457e6d + fa1b586 commit cdd343e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 10 deletions.
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:1.17 as builder

ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct

WORKDIR /app

COPY . .

RUN GOOS=linux GOARCH=amd64 go build -o kcl-playground


FROM kusionstack/kusion:v0.7.2

WORKDIR /app

COPY --from=builder /app/kcl-playground .

EXPOSE 2022


CMD ["./kcl-playground -deploy"]
26 changes: 16 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package main

import (
"flag"
"fmt"
"os/exec"
"runtime"
Expand All @@ -14,17 +15,22 @@ import (
)

func main() {
addr := "localhost:2022"
fmt.Printf("listen at http://%s\n", addr)

go func() {
time.Sleep(time.Second * 2)
openBrowser(addr)
}()

play.Run(addr, &play.Option{
deploy_mode := flag.Bool("deploy", false, "Whether is deploy mode")
flag.Parse()
opt := play.Option{
PlayMode: true,
})
}
if *deploy_mode {
play.Run(":80", &opt)
} else {
addr := "localhost:2023"
fmt.Printf("listen at http://%s\n", addr)
go func() {
time.Sleep(time.Second * 2)
openBrowser(addr)
}()
play.Run(addr, &opt)
}
}

func openBrowser(url string) error {
Expand Down

0 comments on commit cdd343e

Please sign in to comment.