Spaces:
Paused
Paused
Update Dockerfile
Browse files- Dockerfile +9 -11
Dockerfile
CHANGED
|
@@ -1,26 +1,24 @@
|
|
| 1 |
-
# ---------- Stage 1:
|
| 2 |
FROM debian:stable-slim AS fetcher
|
| 3 |
-
|
| 4 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 5 |
-
ca-certificates curl tar && \
|
| 6 |
rm -rf /var/lib/apt/lists/*
|
| 7 |
-
|
| 8 |
WORKDIR /tmp
|
| 9 |
ARG OPENLIST_VERSION=beta
|
| 10 |
RUN curl -L -o openlist.tar.gz \
|
| 11 |
-
|
| 12 |
tar -xzf openlist.tar.gz && \
|
| 13 |
chmod +x openlist
|
| 14 |
|
| 15 |
-
# ---------- Stage 2:
|
| 16 |
FROM gcr.io/distroless/base-debian12
|
| 17 |
|
| 18 |
-
|
| 19 |
WORKDIR /opt/openlist
|
| 20 |
-
COPY --from=fetcher /tmp/openlist /opt/openlist/openlist
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
|
|
|
| 24 |
|
| 25 |
EXPOSE 8080
|
|
|
|
| 26 |
ENTRYPOINT ["./openlist","server"]
|
|
|
|
| 1 |
+
# ---------- Stage 1: 下载 ----------
|
| 2 |
FROM debian:stable-slim AS fetcher
|
| 3 |
+
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl tar && \
|
|
|
|
|
|
|
| 4 |
rm -rf /var/lib/apt/lists/*
|
|
|
|
| 5 |
WORKDIR /tmp
|
| 6 |
ARG OPENLIST_VERSION=beta
|
| 7 |
RUN curl -L -o openlist.tar.gz \
|
| 8 |
+
https://github.com/OpenListTeam/OpenList/releases/download/${OPENLIST_VERSION}/openlist-linux-amd64.tar.gz && \
|
| 9 |
tar -xzf openlist.tar.gz && \
|
| 10 |
chmod +x openlist
|
| 11 |
|
| 12 |
+
# ---------- Stage 2: 运行 ----------
|
| 13 |
FROM gcr.io/distroless/base-debian12
|
| 14 |
|
| 15 |
+
ENV TZ=Asia/Shanghai
|
| 16 |
WORKDIR /opt/openlist
|
|
|
|
| 17 |
|
| 18 |
+
# 把可执行文件 + 一个空 data/ 目录一起复制,并把这整个目录归 nonroot 所有
|
| 19 |
+
COPY --chown=nonroot:nonroot --from=fetcher /tmp/openlist ./openlist
|
| 20 |
+
COPY --chown=nonroot:nonroot --from=fetcher /dev/null ./data/. # 创建空 data/
|
| 21 |
|
| 22 |
EXPOSE 8080
|
| 23 |
+
USER nonroot
|
| 24 |
ENTRYPOINT ["./openlist","server"]
|