Update Dockerfile
Browse files1123456348910561278141516910181920211112232425131427282930313233343536373815FROM node:16 as builderFROM ghcr.io/martialbe/one-api as builder
WORKDIR /buildRUN git clone https://github.com/MartialBE/one-api.git .RUN sed -i'' 's|router.Group("/v1|router.Group("/api/v1|g' /build/router/relay-router.goRUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/api/v1|g' /build/relay/common.goFROM --platform=$BUILDPLATFORM caddy:2.6.2-alpine AS runner
WORKDIR /build/webRUN npm installRUN DISABLE_ESLINT_PLUGIN='true' REACT_APP_VERSION=$(cat ../VERSION) npm run buildWORKDIR /app
FROM golang AS builder2COPY --from=builder /one-api /app/one-api
ENV GO111MODULE=on \ CGO_ENABLED=1 \ GOOS=linuxCOPY Caddyfile ./Caddyfile
WORKDIR /buildRUN git clone https://github.com/MartialBE/one-api.git .RUN sed -i'' 's|router.Group("/v1|router.Group("/api/v1|g' /build/router/relay-router.goRUN sed -i'' 's|HasPrefix(path, "/v1|HasPrefix(path, "/api/v1|g' /build/relay/common.goRUN chmod 777 -R /app
RUN go mod downloadCOPY --from=builder /build/web/build ./web/buildRUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-apiEXPOSE 3001
FROM alpine
RUN apk update \ && apk upgrade \ && apk add --no-cache ca-certificates tzdata \ && update-ca-certificates 2>/dev/null || true
COPY --from=builder2 /build/one-api /EXPOSE 3000WORKDIR /dataRUN chmod 777 -R /dataENTRYPOINT ["/one-api"]CMD ["sh", "-c", "caddy run --config /app/Caddyfile & /app/one-api"]Dockerfile+8-31