Fix dev workflow hanging and implement runtime branch detection
- Fix duplicate Dockerfile sections that were causing build hangs - Replace complex build args with simple runtime git branch detection - Revert CI workflows to working state (remove build args and debug code) - Add automatic version tagging: dev branch shows "0.2.15-dev" - Enhanced movie fallback logic for rename-first scenarios - Improved logging to trace movie date decision process
This commit is contained in:
+6
-37
@@ -1,19 +1,11 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Build arguments for version tagging
|
||||
ARG BUILD_TYPE=production
|
||||
ARG IMAGE_TAG=latest
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Set environment variables for version detection
|
||||
ENV BUILD_TYPE=${BUILD_TYPE}
|
||||
ENV IMAGE_TAG=${IMAGE_TAG}
|
||||
|
||||
# Single layer for all system setup to minimize image size
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
sqlite3 curl gosu \
|
||||
sqlite3 curl gosu git \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& apt-get clean \
|
||||
&& groupadd -g 1000 appuser \
|
||||
@@ -31,6 +23,10 @@ COPY core/ ./core/
|
||||
COPY clients/ ./clients/
|
||||
COPY nfoguard.py .
|
||||
|
||||
# Copy git info to detect branch at runtime
|
||||
COPY .git/HEAD .git/
|
||||
COPY .git/refs/ .git/refs/
|
||||
|
||||
# Final setup in single layer
|
||||
RUN mkdir -p /app/data \
|
||||
&& chown -R appuser:appuser /app \
|
||||
@@ -43,31 +39,4 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["python", "nfoguard.py"]
|
||||
|
||||
# Root-aware entrypoint
|
||||
RUN echo '#!/bin/bash' > /entrypoint.sh && \
|
||||
echo 'set -euo pipefail' >> /entrypoint.sh && \
|
||||
echo '' >> /entrypoint.sh && \
|
||||
echo 'PUID=${PUID:-1000}' >> /entrypoint.sh && \
|
||||
echo 'PGID=${PGID:-1000}' >> /entrypoint.sh && \
|
||||
echo '' >> /entrypoint.sh && \
|
||||
echo 'if [ "$(id -u)" -eq 0 ]; then' >> /entrypoint.sh && \
|
||||
echo ' # running as root: we can adjust IDs and drop privileges' >> /entrypoint.sh && \
|
||||
echo ' groupmod -o -g "$PGID" appuser 2>/dev/null || groupadd -o -g "$PGID" appuser' >> /entrypoint.sh && \
|
||||
echo ' id appuser &>/dev/null || useradd -o -u "$PUID" -g "$PGID" -m appuser' >> /entrypoint.sh && \
|
||||
echo ' usermod -o -u "$PUID" -g "$PGID" appuser 2>/dev/null || true' >> /entrypoint.sh && \
|
||||
echo ' chown -R "$PUID:$PGID" /app || true' >> /entrypoint.sh && \
|
||||
echo ' exec gosu appuser "$@"' >> /entrypoint.sh && \
|
||||
echo 'else' >> /entrypoint.sh && \
|
||||
echo ' # not root (e.g., compose set user: 1000:1000) — just run' >> /entrypoint.sh && \
|
||||
echo ' exec "$@"' >> /entrypoint.sh && \
|
||||
echo 'fi' >> /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8080/health || exit 1
|
||||
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["python", "nfoguard.py"]
|
||||
CMD ["python", "nfoguard.py"]
|
||||
Reference in New Issue
Block a user