Skip to content

Commit de7a10c

Browse files
authored
Add clarifying comments to the Dockerfile. (GoogleCloudPlatform#11277)
* Add clarifying comments to the dockerfile. * Opt out 3.12.
1 parent 6ca5ff9 commit de7a10c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

dataflow/flex-templates/streaming_beam/Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,29 @@
1414

1515
FROM gcr.io/dataflow-templates-base/python3-template-launcher-base
1616

17+
# Configure the Template to launch the pipeline with a --requirements_file option.
18+
# See: https://beam.apache.org/documentation/sdks/python-pipeline-dependencies/#pypi-dependencies
1719
ENV FLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILE="/template/requirements.txt"
1820
ENV FLEX_TEMPLATE_PYTHON_PY_FILE="/template/streaming_beam.py"
1921

2022
COPY . /template
2123

22-
# We could get rid of installing libffi-dev and git, or we could leave them.
2324
RUN apt-get update \
25+
# Install any apt packages if required by your template pipeline.
2426
&& apt-get install -y libffi-dev git \
2527
&& rm -rf /var/lib/apt/lists/* \
2628
# Upgrade pip and install the requirements.
2729
&& pip install --no-cache-dir --upgrade pip \
30+
# Install dependencies from requirements file in the launch environment.
2831
&& pip install --no-cache-dir -r $FLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILE \
29-
# Download the requirements to speed up launching the Dataflow job.
32+
# When FLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILE option is used,
33+
# then during Template launch Beam downloads dependencies
34+
# into a local requirements cache folder and stages the cache to workers.
35+
# To speed up Flex Template launch, pre-download the requirements cache
36+
# when creating the Template.
3037
&& pip download --no-cache-dir --dest /tmp/dataflow-requirements-cache -r $FLEX_TEMPLATE_PYTHON_REQUIREMENTS_FILE
3138

32-
# Since we already downloaded all the dependencies, there's no need to rebuild everything.
39+
# Set this if using Beam 2.37.0 or earlier SDK to speed up job submission.
3340
ENV PIP_NO_DEPS=True
3441

3542
ENTRYPOINT ["/opt/google/dataflow/python_template_launcher"]

dataflow/flex-templates/streaming_beam/noxfile_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# > ℹ️ We're opting out of all Python versions except 3.8.
2626
# > The Python version used is defined by the Dockerfile, so it's redundant
2727
# > to run multiple tests since they would all be running the same Dockerfile.
28-
"ignored_versions": ["2.7", "3.6", "3.7", "3.9", "3.10", "3.11"],
28+
"ignored_versions": ["2.7", "3.6", "3.7", "3.9", "3.10", "3.11", "3.12"],
2929
# Old samples are opted out of enforcing Python type hints
3030
# All new samples should feature them
3131
"enforce_type_hints": True,

0 commit comments

Comments
 (0)