Skip to content

Commit

Permalink
chore: docker使用scratch镜像
Browse files Browse the repository at this point in the history
  • Loading branch information
TBXark committed Sep 18, 2024
1 parent b5e551a commit 24228a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ COPY . .
RUN go mod download
RUN make build

FROM alpine:latest
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
COPY --from=builder /app/build/azure2openai /main
ENTRYPOINT ["/main"]
CMD ["--config", "/config.json"]
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ func main() {
if err != nil {
log.Fatal(err)
}
startServer(config)
}

func startServer(config *Config) {
http.HandleFunc("/v1/chat/completions", azureRedirect(config.EndpointFormat.ChatCompletions, config))
http.HandleFunc("images/generations", azureRedirect(config.EndpointFormat.ImageGenerations, config))
http.HandleFunc("/v1/models", azureRedirect(config.EndpointFormat.Models, config))
Expand Down

0 comments on commit 24228a5

Please sign in to comment.