Running alembic migrations whenever api container is started.

This commit is contained in:
Roland 2025-06-29 18:38:32 -06:00
parent 78a83dc63e
commit 833f58dbfb
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
9 changed files with 131 additions and 28 deletions

View file

@ -2,26 +2,30 @@ FROM python:3.11-buster
ENV DOCKER=true
WORKDIR /opt/wrolpi
# Update dependencies and install required packages.
# Update dependencies and install required packages
RUN apt-get update && \
apt-get install -y ffmpeg catdoc sysstat aria2 && \
apt-get install -y ffmpeg catdoc sysstat aria2 postgresql-client && \
ffmpeg -version && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Create cache directory for yt-dlp.
# Create cache directory for yt-dlp
RUN mkdir /.cache && chown -R 1000:1000 /.cache
# Install Python dependencies.
# Install Python dependencies
COPY requirements.txt /opt/wrolpi/requirements.txt
RUN pip3 install --no-cache-dir -r /opt/wrolpi/requirements.txt
# Copy WROLPi application files.
# Copy WROLPi application files
COPY main.py /opt/wrolpi/
COPY wrolpi /opt/wrolpi/wrolpi
COPY modules /opt/wrolpi/modules
COPY alembic /opt/wrolpi/alembic
COPY alembic.ini /opt/wrolpi/alembic.ini
COPY docker/api/alembic.ini /opt/wrolpi/alembic.ini
ENTRYPOINT ["python3", "-OO", "/opt/wrolpi/main.py"]
CMD ["-v", "api", "--host", "0.0.0.0"]
# Copy and set up entrypoint script
COPY docker/api/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Use entrypoint script which will run alembic migrations before starting API.
ENTRYPOINT ["/entrypoint.sh"]