smgc commited on
Commit
7e1744f
1 Parent(s): 3fb5267

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +8 -37
Dockerfile CHANGED
@@ -1,44 +1,15 @@
1
- FROM node:16 as builder
2
 
3
- WORKDIR /build
4
- RUN git clone https://github.com/MartialBE/one-api.git .
5
- RUN sed -i'' 's|router.Group("/v1|router.Group("/api/v1|g' /build/router/relay-router.go
6
- RUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/api/v1|g' /build/relay/common.go
7
- RUN sed -i'' 's|Messages: |messages: |g' /build/controller/channel-test.go
8
- RUN sed -i'' 's|Role: |role: |g' /build/controller/channel-test.go
9
- RUN sed -i'' 's|Content: |content: |g' /build/controller/channel-test.go
10
- RUN sed -i'' 's|Model: |model: |g' /build/controller/channel-test.go
11
- RUN sed -i'' 's|MaxTokens: |max_tokens: |g' /build/controller/channel-test.go
12
- RUN sed -i'' 's|Stream: |stream: |g' /build/controller/channel-test.go
13
 
14
- WORKDIR /build/web
15
- RUN npm install
16
- RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ../VERSION) npm run build
17
 
18
- FROM golang AS builder2
19
 
20
- ENV GO111MODULE=on \
21
- CGO_ENABLED=1 \
22
- GOOS=linux
23
 
24
- WORKDIR /build
25
- RUN git clone https://github.com/MartialBE/one-api.git .
26
- RUN sed -i'' 's|router.Group("/v1|router.Group("/api/v1|g' /build/router/relay-router.go
27
- RUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/api/v1|g' /build/relay/common.go
28
 
29
- RUN go mod download
30
- COPY --from=builder /build/web/build ./web/build
31
- RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
32
 
33
- FROM alpine
34
-
35
- RUN apk update \
36
- && apk upgrade \
37
- && apk add --no-cache ca-certificates tzdata \
38
- && update-ca-certificates 2>/dev/null || true
39
-
40
- COPY --from=builder2 /build/one-api /
41
- EXPOSE 3000
42
- WORKDIR /data
43
- RUN chmod 777 -R /data
44
- ENTRYPOINT ["/one-api"]
 
1
+ FROM ghcr.io/martialbe/one-api as builder
2
 
3
+ FROM --platform=$BUILDPLATFORM caddy:alpine AS runner
 
 
 
 
 
 
 
 
 
4
 
5
+ WORKDIR /app
 
 
6
 
7
+ COPY --from=builder /one-api ./one-api
8
 
9
+ COPY Caddyfile ./Caddyfile
 
 
10
 
11
+ RUN chmod 777 -R /app
 
 
 
12
 
13
+ EXPOSE 3001
 
 
14
 
15
+ CMD ["sh", "-c", "caddy run --config /app/Caddyfile & /app/one-api"]