diff --git a/Dockerfile b/Dockerfile index a6f953d..c53cc1a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..5240d01 --- /dev/null +++ b/entrypoint.sh @@ -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 "$@" diff --git a/seed/worklog.db b/seed/worklog.db new file mode 100644 index 0000000..9c725ca Binary files /dev/null and b/seed/worklog.db differ