Last active
March 25, 2021 04:42
-
-
Save gnomezgrave/6e19f66f779d2ab56d98ad11d7452ee7 to your computer and use it in GitHub Desktop.
Dataflow Flex Templates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM gcr.io/dataflow-templates-base/python3-template-launcher-base | |
RUN mkdir -p /dataflow/template | |
WORKDIR /dataflow/template | |
COPY pipeline ${WORKDIR}/pipeline | |
COPY spec/python_command_spec.json ${WORKDIR}/python_command_spec.json | |
ENV DATAFLOW_PYTHON_COMMAND_SPEC ${WORKDIR}/python_command_spec.json | |
RUN pip install avro-python3 pyarrow==0.11.1 apache-beam[gcp]==2.24.0 | |
COPY setup.py ${WORKDIR}/setup.py | |
COPY main.py ${WORKDIR}/main.py | |
# Super important to add these lines. | |
ENV FLEX_TEMPLATE_PYTHON_SETUP_FILE="${WORKDIR}/setup.py" | |
ENV FLEX_TEMPLATE_PYTHON_PY_FILE="${WORKDIR}/main.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"docker_template_spec": { | |
"docker_image": "gcr.io/my-awesome-project/my_logic:latest" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"pyFile":"/dataflow/template/main.py" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import setuptools | |
setuptools.setup( | |
packages=setuptools.find_packages(), | |
install_requires=[ | |
'apache-beam[gcp]==2.24.0', | |
'google-cloud-storage' | |
], | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment