HuggingFace0920 commited on
Commit
4b22329
·
verified ·
1 Parent(s): 11fe6e4

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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
- https://github.com/OpenListTeam/OpenList/releases/download/${OPENLIST_VERSION}/openlist-linux-amd64.tar.gz && \
12
  tar -xzf openlist.tar.gz && \
13
  chmod +x openlist
14
 
15
- # ---------- Stage 2: 最终运行环境 ----------
16
  FROM gcr.io/distroless/base-debian12
17
 
18
- LABEL maintainer="[email protected]"
19
  WORKDIR /opt/openlist
20
- COPY --from=fetcher /tmp/openlist /opt/openlist/openlist
21
 
22
- # 时区:只需要告诉 glibc 使用哪个 tz,不必携带 tzdata 全表
23
- ENV TZ=Asia/Shanghai
 
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"]