Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +15 -33
Dockerfile
CHANGED
@@ -1,41 +1,23 @@
|
|
1 |
-
FROM
|
2 |
|
3 |
-
|
4 |
-
RUN git clone https://github.com/MartialBE/one-hub.git .
|
5 |
-
RUN wget -qO- -t1 -T2 "https://api.github.com/repos/MartialBE/one-hub/releases" | \
|
6 |
-
grep "tag_name" | \
|
7 |
-
head -n 1 | \
|
8 |
-
awk -F ":" '{print $2}' | \
|
9 |
-
sed 's/\"//g;s/,//g;s/ //g' > VERSION
|
10 |
|
11 |
-
|
12 |
-
|
13 |
|
14 |
-
|
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 |
-
WORKDIR /build
|
25 |
-
COPY --from=builder /build .
|
26 |
-
RUN go mod download
|
27 |
-
RUN go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
|
28 |
-
|
29 |
-
FROM alpine
|
30 |
-
|
31 |
-
RUN apk update \
|
32 |
-
&& apk upgrade \
|
33 |
-
&& apk add --no-cache ca-certificates tzdata \
|
34 |
-
&& update-ca-certificates 2>/dev/null || true
|
35 |
|
36 |
-
|
37 |
|
38 |
-
EXPOSE 3000
|
39 |
-
WORKDIR /data
|
40 |
RUN chmod 777 -R /data
|
41 |
-
|
|
|
|
1 |
+
FROM ghcr.io/martialbe/one-api:latest
|
2 |
|
3 |
+
RUN apk add --no-cache pcre2
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
+
COPY --from=nginx:alpine /etc/nginx /etc/nginx
|
6 |
+
COPY --from=nginx:alpine /usr/sbin/nginx /usr/sbin/nginx
|
7 |
|
8 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
|
9 |
|
10 |
+
RUN mkdir -p /var/log/nginx && \
|
11 |
+
mkdir -p /var/cache/nginx && \
|
12 |
+
mkdir -p /var/run && \
|
13 |
+
chmod -R 777 /var/log/nginx && \
|
14 |
+
chmod -R 777 /var/cache/nginx && \
|
15 |
+
chmod -R 777 /var/run
|
16 |
|
17 |
+
WORKDIR /data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
+
EXPOSE 3001
|
20 |
|
|
|
|
|
21 |
RUN chmod 777 -R /data
|
22 |
+
|
23 |
+
ENTRYPOINT ["sh", "-c", "nginx & /one-api"]
|