Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +8 -37
Dockerfile
CHANGED
@@ -1,44 +1,15 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
-
|
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 /
|
15 |
-
RUN npm install
|
16 |
-
RUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ../VERSION) npm run build
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
CGO_ENABLED=1 \
|
22 |
-
GOOS=linux
|
23 |
|
24 |
-
|
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 |
-
|
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 |
-
|
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"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|