add seed database and entrypoint for data sync

This commit is contained in:
2026-10-29 17:23:12 +08:00
parent 912b0fd256
commit 10d6b4cc3d
3 changed files with 17 additions and 0 deletions
+5
View File
@@ -8,6 +8,7 @@ RUN pip install --no-cache-dir -r /app/requirements.txt
COPY server /app/server
COPY dist /app/dist
COPY config.toml /app/config.toml
COPY seed /app/seed
RUN mkdir -p /app/data
@@ -20,4 +21,8 @@ EXPOSE 37777
VOLUME /app/data
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["python", "-m", "server.main"]
+12
View File
@@ -0,0 +1,12 @@
#!/bin/sh
set -e
mkdir -p /app/data
if [ ! -f /app/data/worklog.db ]; then
if [ -f /app/seed/worklog.db ]; then
echo "[entrypoint] Seeding database from /app/seed/worklog.db"
cp /app/seed/worklog.db /app/data/worklog.db
else
echo "[entrypoint] No seed database found, starting with empty database"
fi
fi
exec "$@"
BIN
View File
Binary file not shown.