62 lines
2.2 KiB
Docker
62 lines
2.2 KiB
Docker
FROM apache/airflow:2.10.5
|
|
ENV AIRFLOW_VERSION=2.10.5
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy necessary files from the ytdlp-ops-auth subdirectory (present in the build context) into /app
|
|
# setup.py is removed as we are not using 'pip install -e' anymore
|
|
COPY ytdlp-ops-auth/generate-thrift.py ytdlp-ops-auth/requirements.txt /app/
|
|
COPY ytdlp-ops-auth/thrift_model/ /app/thrift_model/
|
|
COPY ytdlp-ops-auth/ytdlp_utils.py /app/
|
|
COPY ytdlp-ops-auth/thrift_exceptions_patch.py /app/
|
|
COPY ytdlp-ops-auth/ytdlp_ops_client.py /app/
|
|
|
|
# Set Python path relative to the WORKDIR /app
|
|
ENV PYTHONPATH=/app:${PYTHONPATH}
|
|
|
|
# Install system dependencies
|
|
USER root
|
|
RUN apt-get update && \
|
|
apt-get install -y --no-install-recommends \
|
|
vim \
|
|
mc \
|
|
jq \
|
|
build-essential \
|
|
python3-dev && \
|
|
apt-get clean && \
|
|
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc /usr/share/doc-base
|
|
|
|
# Ensure proper permissions, aligning GID with docker-compose.yaml (1001)
|
|
RUN groupadd -g 1001 airflow && \
|
|
usermod -a -G airflow airflow && \
|
|
chown -R airflow:1001 /app
|
|
|
|
# Switch to airflow user for package installation
|
|
USER airflow
|
|
|
|
# Install Python dependencies and ensure ffprobe3 is installed correctly
|
|
RUN pip install --no-cache-dir \
|
|
"apache-airflow==${AIRFLOW_VERSION}" && \
|
|
pip install --no-cache-dir -r /app/requirements.txt && \
|
|
pip install --no-cache-dir ffprobe3 python-ffmpeg
|
|
|
|
# Only generate Thrift files if gen_py directory doesn't exist
|
|
RUN if [ ! -d "/app/thrift_model/gen_py" ]; then \
|
|
python3 /app/generate-thrift.py; \
|
|
else \
|
|
echo "Skipping Thrift generation - gen_py directory already exists"; \
|
|
fi
|
|
|
|
# Create proper Python package structure
|
|
RUN mkdir -p /app/pangramia && \
|
|
ln -s /app/thrift_model/gen_py/pangramia /app/pangramia && \
|
|
echo "Created symlink: /app/pangramia -> /app/thrift_model/gen_py/pangramia"
|
|
|
|
# Ensure base_service is accessible
|
|
RUN mkdir -p /app/pangramia/base_service && \
|
|
ln -s /app/thrift_model/gen_py/pangramia/base_service /app/pangramia/base_service && \
|
|
echo "Created symlink: /app/pangramia/base_service -> /app/thrift_model/gen_py/pangramia/base_service"
|
|
|
|
# Add to Python path
|
|
ENV PYTHONPATH=/app:/app/thrift_model/gen_py:${PYTHONPATH}
|