mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-27 04:57:42 +08:00
feat: dokcer image support PUID PGID
This commit is contained in:
11
Dockerfile
11
Dockerfile
@@ -25,16 +25,17 @@ COPY --from=flutter /app/build/web ./ui/build/web/
|
|||||||
RUN CGO_ENABLED=1 go build -o polaris -ldflags="-X polaris/db.Version=$(git describe --tags --long)" ./cmd/
|
RUN CGO_ENABLED=1 go build -o polaris -ldflags="-X polaris/db.Version=$(git describe --tags --long)" ./cmd/
|
||||||
|
|
||||||
FROM debian:stable-slim
|
FROM debian:stable-slim
|
||||||
ENV TZ="Asia/Shanghai" GIN_MODE=release
|
ENV TZ="Asia/Shanghai" GIN_MODE=release PUID=0 PGID=0 UMASK=0 PERMS=true
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN apt-get update && apt-get -y install ca-certificates
|
RUN apt-get update && apt-get -y install ca-certificates tzdata gosu tini && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||||
|
&& echo "${TZ}" > /etc/timezone && apt-get clean
|
||||||
|
|
||||||
# 将上一个阶段publish文件夹下的所有文件复制进来
|
# 将上一个阶段publish文件夹下的所有文件复制进来
|
||||||
COPY --from=builder /app/polaris .
|
COPY --from=builder /app/polaris .
|
||||||
|
COPY --from=builder /app/entrypoint.sh .
|
||||||
|
|
||||||
|
VOLUME /app/data
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
#USER 1000:1000
|
ENTRYPOINT ["tini","./entrypoint.sh"]
|
||||||
|
|
||||||
ENTRYPOINT ["./polaris"]
|
|
||||||
9
entrypoint.sh
Normal file
9
entrypoint.sh
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
## 重设权限
|
||||||
|
chown -R "${PUID}:${PGID}" /app/data
|
||||||
|
|
||||||
|
umask ${UMASK:-022}
|
||||||
|
|
||||||
|
cd /app
|
||||||
|
exec gosu "${PUID}:${PGID}" /app/polaris
|
||||||
Reference in New Issue
Block a user