update docker related files

This commit is contained in:
Simon Ding
2025-08-31 22:47:38 +08:00
parent e27b327f93
commit a978ae4fba
6 changed files with 60 additions and 3 deletions

37
docker/Dockerfile Normal file
View File

@@ -0,0 +1,37 @@
FROM golang:1.24 as builder
# 启用go module
ENV GO111MODULE=on
#GOPROXY=https://goproxy.cn,direct
WORKDIR /app
ARG TMDB_API_KEY
COPY go.mod .
COPY go.sum .
RUN go mod download
COPY . .
# 指定OS等并go build
RUN CGO_ENABLED=0 go build -o polaris -ldflags="-X polaris/db.Version=$(git describe --tags --long) -X polaris/db.DefaultTmdbApiKey=$(echo $TMDB_API_KEY)" ./cmd/polaris
FROM debian:stable-slim
WORKDIR /app
RUN apt-get update && apt-get -y install ca-certificates tzdata gosu tini locales && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo "${TZ}" > /etc/timezone && apt-get clean && sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && locale-gen
ENV TZ="Asia/Shanghai" GIN_MODE=release PUID=0 PGID=0 UMASK=0
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8
# 将上一个阶段publish文件夹下的所有文件复制进来
COPY --from=builder /app/polaris .
COPY --from=builder /app/entrypoint.sh .
RUN chmod +x /app/entrypoint.sh
VOLUME /app/data
EXPOSE 8080
ENTRYPOINT ["tini","./entrypoint.sh"]

45
docker/docker-compose.yml Normal file
View File

@@ -0,0 +1,45 @@
services:
polaris:
image: ghcr.io/simon-ding/polaris:latest
restart: always
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ${CONFIGURATION_FILE_LOCATION}/polaris:/app/data
- ${DOWNLOAD_LOCATION}:/downloads
- ${MEDIA_LOCATION}:/data
env_file:
- .env
ports:
- 8080:8080
transmission:
image: lscr.io/linuxserver/transmission:latest
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ${CONFIGURATION_FILE_LOCATION}/transmission:/config
- ${DOWNLOAD_LOCATION}:/downloads
env_file:
- .env
ports:
- 9091:9091
- 51413:51413
- 51413:51413/udp
prowlarr:
image: lscr.io/linuxserver/prowlarr:latest
container_name: prowlarr
environment:
- PUID=1000
- PGID=1000
- TZ=${TIMEZONE}
volumes:
- ${CONFIGURATION_FILE_LOCATION}/prowlar:/config
env_file:
- .env
ports:
- 9696:9696
restart: unless-stopped

12
docker/example.env Normal file
View File

@@ -0,0 +1,12 @@
#下载路径
DOWNLOAD_LOCATION=/downloads
#媒体数据存储路径也可以启动自己配置webdav存储
MEDIA_LOCATION=/data
#程序配置文件存放路径
CONFIGURATION_FILE_LOCATION=./config
#时区
TIMEZONE=Asia/Shanghai