feat: initialize database with demo data on first run and update README
Some checks failed
Backend CI / lint-and-test (push) Failing after 1m33s
Frontend CI / lint-and-build (push) Successful in 17s

This commit is contained in:
2025-10-11 21:52:30 +02:00
parent 25ca7ab196
commit f9086d2d04
4 changed files with 27 additions and 4 deletions

View File

@@ -8,15 +8,26 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
WORKDIR /app
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential libpq-dev \
&& apt-get install -y --no-install-recommends build-essential libpq-dev postgresql-client \
&& rm -rf /var/lib/apt/lists/*
COPY backend/requirements/base.txt ./backend/requirements/base.txt
RUN pip install --upgrade pip \
&& pip install -r backend/requirements/base.txt
COPY scripts ./scripts
COPY .env.example ./.env.example
COPY .env* ./
COPY backend ./backend
EXPOSE 8000
CMD ["uvicorn", "backend.app.main:app", "--host", "0.0.0.0", "--port", "8000"]
# Initialize database with demo data if INIT_DEMO_DB is set
CMD ["sh", "-c", "\
export PYTHONPATH=/app && \
echo 'Waiting for database...' && \
while ! pg_isready -h db -p 5432 -U railgame >/dev/null 2>&1; do sleep 1; done && \
echo 'Database is ready!' && \
if [ \"$INIT_DEMO_DB\" = \"true\" ]; then python scripts/init_demo_db.py; fi && \
uvicorn backend.app.main:app --host 0.0.0.0 --port 8000"]