Skip to content

Commit f9074a5

Browse files
committed
add static and Template files
1 parent 91b6534 commit f9074a5

File tree

2 files changed

+50
-4
lines changed

2 files changed

+50
-4
lines changed

Dockerfile

+9-4
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,14 @@ RUN /tmp/atlas_install.sh
4545

4646

4747
RUN mkdir -p /app/db/migrations
48-
COPY --from=builder /app/server /app/server
49-
COPY db/schema.sql /app/db/schema.sql
50-
COPY db/migrations/* /app/db/migrations
51-
RUN chmod +x /app/server
48+
5249
WORKDIR /app
50+
51+
COPY --from=builder /app/server /app/server
52+
COPY db/schema.sql db/schema.sql
53+
COPY db/migrations/*db/migrations
54+
COPY public public
55+
COPY templates templates
56+
RUN chmod +x server
57+
5358
CMD ["/app/server"]

main.go

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package main
2+
3+
import "embed"
4+
5+
// content holds our static web server content.
6+
//go:embed db/migrations/* db/schema.sql
7+
//go:embed templates/* public/*
8+
9+
//go:embed html/index.html
10+
var content embed.FS
11+
12+
import (
13+
"log"
14+
"net/http"
15+
api "openai-api-proxy/api"
16+
proxy "openai-api-proxy/apiproxy"
17+
auth "openai-api-proxy/auth"
18+
db "openai-api-proxy/db"
19+
web "openai-api-proxy/webui"
20+
21+
"github.com/joho/godotenv"
22+
)
23+
24+
func main() {
25+
log.Println("openai-proxy started")
26+
err := godotenv.Load()
27+
if err != nil {
28+
log.Println("Warning: not able to loading Env File", err)
29+
}
30+
db.DatabaseInit(content)
31+
mux := http.NewServeMux()
32+
a := auth.Init(mux)
33+
//
34+
proxy.Init(mux) // Start AI Proxy
35+
go web.Init(mux, a, content) // Start Web UI
36+
go api.ApiInit(mux, a) // Start Backend API
37+
38+
log.Printf("Serving on http://localhost:%d", 8082)
39+
log.Fatal(http.ListenAndServe(":8082", mux))
40+
41+
}

0 commit comments

Comments
 (0)