Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +11 -8
Dockerfile
CHANGED
@@ -2,8 +2,6 @@ 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 |
|
8 |
WORKDIR /build/web
|
9 |
RUN npm install
|
@@ -16,15 +14,14 @@ ENV GO111MODULE=on \
|
|
16 |
GOOS=linux
|
17 |
|
18 |
WORKDIR /build
|
19 |
-
RUN git clone https://github.com/MartialBE/one-api.git .
|
20 |
-
RUN sed -i'' 's|router.Group("/v1|router.Group("/api/v1|g' /build/router/relay-router.go
|
21 |
-
RUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/api/v1|g' /build/relay/common.go
|
22 |
|
|
|
23 |
RUN go mod download
|
|
|
24 |
COPY --from=builder /build/web/build ./web/build
|
25 |
RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
|
26 |
|
27 |
-
FROM alpine
|
28 |
|
29 |
RUN apk update \
|
30 |
&& apk upgrade \
|
@@ -32,7 +29,13 @@ RUN apk update \
|
|
32 |
&& update-ca-certificates 2>/dev/null || true
|
33 |
|
34 |
COPY --from=builder2 /build/one-api /
|
35 |
-
|
|
|
|
|
|
|
36 |
WORKDIR /data
|
|
|
37 |
RUN chmod 777 -R /data
|
38 |
-
|
|
|
|
|
|
2 |
|
3 |
WORKDIR /build
|
4 |
RUN git clone https://github.com/MartialBE/one-api.git .
|
|
|
|
|
5 |
|
6 |
WORKDIR /build/web
|
7 |
RUN npm install
|
|
|
14 |
GOOS=linux
|
15 |
|
16 |
WORKDIR /build
|
|
|
|
|
|
|
17 |
|
18 |
+
COPY --from=builder /build /
|
19 |
RUN go mod download
|
20 |
+
|
21 |
COPY --from=builder /build/web/build ./web/build
|
22 |
RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
|
23 |
|
24 |
+
FROM --platform=$BUILDPLATFORM caddy:2.6.2-alpine AS runner
|
25 |
|
26 |
RUN apk update \
|
27 |
&& apk upgrade \
|
|
|
29 |
&& update-ca-certificates 2>/dev/null || true
|
30 |
|
31 |
COPY --from=builder2 /build/one-api /
|
32 |
+
COPY Caddyfile ./Caddyfile
|
33 |
+
|
34 |
+
EXPOSE 3001
|
35 |
+
|
36 |
WORKDIR /data
|
37 |
+
|
38 |
RUN chmod 777 -R /data
|
39 |
+
RUN touch /data/caddy.log && chmod 777 -R /data/caddy.log
|
40 |
+
|
41 |
+
CMD ["sh", "-c", "./oen-api & caddy run --config /data/Caddyfile"]
|