Skip to content

Commit

Permalink
simplify dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
andtheysay committed Aug 16, 2024
1 parent 3dc3e5e commit f371e29
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ FROM docker.io/apache/airflow:2.9.3-python3.12

# Create folders
RUN mkdir -p /opt/airflow/include/custom_operators && \
mkdir -p /opt/airflow/include/custom_hooks
mkdir -p /opt/airflow/include/custom_hooks && \
mkdir -p /opt/airflow/include/custom_sensors

# Install packages in one layer to reduce image size
RUN pip3 install --no-cache-dir \
Expand All @@ -12,11 +13,10 @@ RUN pip3 install --no-cache-dir \
numpy \
pulsar-client[all]

# Download and extract the latest plugin version
RUN LATEST_URL=$(curl -s https://api.github.com/repos/andtheysay/airflow-pulsar-plugin/releases/latest | grep "tarball_url" | cut -d '"' -f 4) && \
curl -L ${LATEST_URL} | tar -xz -C /tmp && \
mv /tmp/yourusername-airflow-pulsar-plugin-*/src/airflow_pulsar_plugin/* /opt/airflow/include/ && \
rm -rf /tmp/yourusername-airflow-pulsar-plugin-*
# Copy pulsar files
COPY src/pulsar_operator.py /opt/airflow/include/custom_operators/
COPY src/pulsar_hook.py /opt/airflow/include/custom_hooks/
COPY src/pulsar_sensor.py /opt/airflow/include/custom_sensors/

# Set env variable PYTHONPATH to /opt/airflow/include
ENV PYTHONPATH "${PYTHONPATH}:/opt/airflow/include"

0 comments on commit f371e29

Please sign in to comment.