From dc9b501e353417ed7e6e0b88fe0a7561e5844979 Mon Sep 17 00:00:00 2001 From: ilkei <62320562+1lkei@users.noreply.github.com> Date: Wed, 27 Nov 2024 13:40:28 +0800 Subject: [PATCH] feat: optimize docker build (#827) --- Dockerfile | 5 ++--- docker-compose.yml | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1f83147cc..2f6992103 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,14 +8,13 @@ RUN CGO_ENABLED=0 go build -tags nosqlite,web \ -ldflags="-s -w -X github.com/GopeedLab/gopeed/pkg/base.Version=$VERSION -X github.com/GopeedLab/gopeed/pkg/base.InDocker=true" \ -o dist/gopeed github.com/GopeedLab/gopeed/cmd/web -FROM alpine:3.14.2 +FROM alpine:3.18 LABEL maintainer="monkeyWie" WORKDIR /app COPY --from=go /app/dist/gopeed ./ COPY entrypoint.sh ./entrypoint.sh RUN apk update && \ - apk upgrade --no-cache && \ - apk add --no-cache bash su-exec; \ + apk add --no-cache su-exec ; \ chmod +x ./entrypoint.sh && \ rm -rf /var/cache/apk/* VOLUME ["/app/storage"] diff --git a/docker-compose.yml b/docker-compose.yml index 1f816d926..58f0d078e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,12 +1,15 @@ -version: '3' - services: - gopeed: - container_name: gopeed - ports: - - "9999:9999" # HTTP port (host:container) - image: liwei2633/gopeed - volumes: - - ~/gopeed/Downloads:/app/Downloads # mount download path - #- ~/gopeed/storage:/app/storage # if you need to mount storage path, uncomment this line - restart: unless-stopped + gopeed: + container_name: gopeed + ports: + - 9999:9999 # HTTP port (host:container) + environment: + - PUID=0 + - PGID=0 + - UMASK=022 + volumes: + - ~/gopeed/Downloads:/app/Downloads # mount download path + #- ~/gopeed/storage:/app/storage # if you need to mount storage path, uncomment this line + restart: unless-stopped + image: liwei2633/gopeed + # command: -u Username -p Password # optional authentication \ No newline at end of file