mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-21 18:07:34 +08:00
update docker related files
This commit is contained in:
37
docker/Dockerfile
Normal file
37
docker/Dockerfile
Normal 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"]
|
||||
Reference in New Issue
Block a user