feat(docker): 初始化项目并配置定时备份 PostgreSQL 数据库示例

This commit is contained in:
严浩
2025-09-22 23:33:52 +08:00
commit 20808e8a55
9 changed files with 275 additions and 0 deletions

22
Dockerfile Normal file
View File

@@ -0,0 +1,22 @@
FROM alpine:3.22.1 AS base
# 解决时区问题
ENV TZ=Asia/Shanghai
RUN apk add alpine-conf && \
setup-timezone -z Asia/Shanghai && \
apk del alpine-conf
FROM base AS final
# 安装 sqlite 工具cron 默认已包含 (dcron)
RUN apk add --no-cache tini
# 时区
ENV TZ=Asia/Shanghai
# 启动脚本与任务脚本
COPY entrypoint.sh run-cron-tasks.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/run-cron-tasks.sh && \
mkdir -p /docker-entrypoint-init.d /docker-cron.d /var/lib/cron-init
ENTRYPOINT ["/sbin/tini", "--", "entrypoint.sh"]