add seed database and entrypoint for data sync
This commit is contained in:
@@ -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"]
|
||||
|
||||
@@ -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 "$@"
|
||||
Binary file not shown.
Reference in New Issue
Block a user