Browse Source

minor: dockerfile

tuonian 3 months ago
parent
commit
ca0c582b2e
2 changed files with 11 additions and 14 deletions
  1. 5 7
      docker/Dockerfile
  2. 6 7
      docker/Dockerfile-with-nginx

+ 5 - 7
docker/Dockerfile

@@ -11,8 +11,11 @@ RUN --mount=type=cache,target=/go --mount=type=cache,target=/root/.cache/go-buil
 
 FROM debian:sid-slim
 
-RUN mkdir -p /app/static/web
+RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
+    sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
+    apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
 
+RUN mkdir -p /app/static/web
 WORKDIR /app
 COPY --from=builder /app/app /app
 COPY conf /app/conf
@@ -20,12 +23,7 @@ COPY data  /app/data
 #COPY ../server/static  /app/static
 COPY frontend/dist  /app/static/web
 
-RUN chmod +x /app/app
-
-RUN rm -rf /app/static/web/config.js
+RUN chmod +x /app/app && rm -rf /app/static/web/config.js
 
-RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/*
-RUN sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/*
-RUN apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
 
 ENTRYPOINT ["/app/app"]

+ 6 - 7
docker/Dockerfile-with-nginx

@@ -11,6 +11,10 @@ RUN --mount=type=cache,target=/go --mount=type=cache,target=/root/.cache/go-buil
 
 FROM registry.cn-hangzhou.aliyuncs.com/tuon-pub/nginx:1.25.1
 
+RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
+    sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/* && \
+    apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl \
+
 WORKDIR /app
 COPY --from=builder /app/app /app
 COPY conf /app/conf
@@ -19,12 +23,7 @@ COPY data  /app/data
 COPY frontend/dist  /app/static/web
 COPY docker/entrypoint.sh /entrypoint.sh
 
-RUN chmod +x /entrypoint.sh /app/app
-
-RUN rm -rf /app/static/web/config.js
-RUN rm -rf /etc/nginx/conf.d
-RUN sed -i 's/deb.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/*
-RUN sed -i 's/security.debian.org/mirrors.ustc.edu.cn/g' /etc/apt/sources.list.d/*
-RUN apt -qq update && apt -qq install -y --no-install-recommends ca-certificates curl
+RUN chmod +x /entrypoint.sh /app/app && rm -rf /app/static/web/config.js && \
+    rm -rf /etc/nginx/conf.d
 
 ENTRYPOINT ["/entrypoint.sh"]