Skip to content

Commit

Permalink
feat:add iris
Browse files Browse the repository at this point in the history
  • Loading branch information
cbluebird committed Sep 26, 2024
1 parent 520c638 commit d6d0c33
Show file tree
Hide file tree
Showing 8 changed files with 300 additions and 2 deletions.
12 changes: 12 additions & 0 deletions Framework/iris/update_cn_dockerfile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

DOCKERFILE=$1
echo "DOCKERFILE: $DOCKERFILE"
TMP_DOCKERFILE="${DOCKERFILE}tmp"
cp "$DOCKERFILE" "$TMP_DOCKERFILE"

sed -i '$i\
COPY /OS/debian-ssh/debian.sources /etc/apt/sources.list.d/debian.sources' "$TMP_DOCKERFILE"

sed -i '$i\
RUN echo "export GOPROXY=https://goproxy.cn,direct" >> /home/sealos/.bashrc && echo "export GOPROXY=https://goproxy.cn,direct" >> /root/.bashrc' "$TMP_DOCKERFILE"
17 changes: 17 additions & 0 deletions Framework/iris/v12.2.11/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ghcr.io/labring-actions/devbox/go-1.22.5:715122

RUN cd /home/sealos/project && \
rm -rf ./*

COPY /Framework/iris/v12.2.11/project /home/sealos/project

RUN chown -R sealos:sealos /home/sealos/project && \
chmod -R u+rw /home/sealos/project && \
chmod -R +x /home/sealos/project/entrypoint.sh

USER sealos
RUN cd /home/sealos/project && \
go mod tidy && \
go build -o main main.go

RUN mkdir /home/sealos/.sealos
1 change: 1 addition & 0 deletions Framework/iris/v12.2.11/project/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./main
51 changes: 51 additions & 0 deletions Framework/iris/v12.2.11/project/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
module main

go 1.22.5

require github.com/kataras/iris/v12 v12.2.11

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect
github.com/CloudyKit/jet/v6 v6.2.0 // indirect
github.com/Joker/jade v1.1.3 // indirect
github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06 // indirect
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/flosch/pongo2/v4 v4.0.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gomarkdown/markdown v0.0.0-20240328165702-4d01890c35c0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/iris-contrib/schema v0.0.6 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/kataras/blocks v0.0.8 // indirect
github.com/kataras/golog v0.1.11 // indirect
github.com/kataras/pio v0.0.13 // indirect
github.com/kataras/sitemap v0.0.6 // indirect
github.com/kataras/tunnel v0.0.4 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/mailgun/raymond/v2 v2.0.48 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/schollz/closestmatch v2.1.0+incompatible // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/tdewolff/minify/v2 v2.20.19 // indirect
github.com/tdewolff/parse/v2 v2.7.12 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yosssi/ace v0.0.5 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
179 changes: 179 additions & 0 deletions Framework/iris/v12.2.11/project/go.sum

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions Framework/iris/v12.2.11/project/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package main

import "github.com/kataras/iris/v12"

type PingResponse struct {
Message string `json:"message"`
}

func main() {
app := iris.New()
app.Use(myMiddleware)

app.Get("/ping", func(ctx iris.Context) {
res := PingResponse{
Message: "pong",
}
ctx.JSON(res)
})

/* Same as:
app.Handle("GET", "/ping", func(ctx iris.Context) {
ctx.JSON(iris.Map{
"message": "pong",
})
})
*/

// Listens and serves incoming http requests
// on http://localhost:8080.
app.Listen(":8080")
}

func myMiddleware(ctx iris.Context) {
ctx.Application().Logger().Infof("Runs before %s", ctx.Path())
ctx.Next()
}
3 changes: 2 additions & 1 deletion configs/name.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ spring-boot=Spring Boot
vue=vue
echo=echo
chi=chi
react=react
react=react
iris=iris
3 changes: 2 additions & 1 deletion configs/port.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ spring-boot=8080
vue=3000
echo=8080
chi=8080
react=3000
iris=8080
react=3000

0 comments on commit d6d0c33

Please sign in to comment.