<commit_before>@(TEMPLATE(
    'snippet/add_generated_comment.Dockerfile.em',
    user_name=user_name,
    tag_name=tag_name,
    source_template_name=template_name,
))@

ARG FROM_IMAGE=osrf/ros2:devel
FROM $FROM_IMAGE
@{
template_dependencies = [
    'wget',
]
packages_to_install = []
if 'upstream_packages' in locals():
    packages_to_install = upstream_packages
if 'ros2_repo_packages' in locals():
    if ros2_repo_packages:
        packages_to_install = packages_to_install + list(set(ros2_repo_packages) - set(packages_to_install))
}@
@
@(TEMPLATE(
    'snippet/install_upstream_package_list.Dockerfile.em',
    packages=template_dependencies,
    upstream_packages=packages_to_install,
))@
@
@[if 'pip3_install' in locals()]@
@[  if pip3_install]@

# install python packages
RUN pip3 install -U \
    @(' \\\n    '.join(pip3_install))@


@[  end if]@
@[end if]@
ARG ROS_DISTRO=@ros2_distro
ENV ROS_DISTRO=$ROS_DISTRO

@
@[if 'rosdep' in locals()]@
@[  if 'rosdistro_index_url' in rosdep]@
ENV ROSDISTRO_INDEX_URL @(rosdep['rosdistro_index_url'])
RUN rosdep update

@[  end if]@
@[end if]@
@
WORKDIR $ROS2_WS
@[if 'vcs' in locals()]@
@[  if vcs]@

@(TEMPLATE(
    'snippet/vcs_import.Dockerfile.em',
    vcs=vcs,
    ws='src',
))@

@[  end if]@
@[end if]@
@
@[if 'rosdep' in locals()]@
@[  if 'install' in rosdep]@
@(TEMPLATE(
    'snippet/install_rosdep_dependencies.Dockerfile.em',
    install_args=rosdep['install'],
))@

@[  end if]@
@[else]@
RUN rosdep update &&\
    rosdep install -y \
    --from-paths src \
    --ignore-src

@[end if]@
@[if 'colcon_args' in locals()]@
@[  if colcon_args]@
# build source
RUN colcon \
    @(' \\\n    '.join(colcon_args))@

@[  end if]@
@[end if]@

ARG RUN_TESTS
ARG FAIL_ON_TEST_FAILURE
RUN if [ ! -z "$RUN_TESTS" ]; then \
        colcon test; \
        if [ ! -z "$FAIL_ON_TEST_FAILURE" ]; then \
            colcon test-result; \
        else \
            colcon test-result || true; \
        fi \
    fi

@[if 'entrypoint_name' in locals()]@
@[  if entrypoint_name]@
@{
entrypoint_file = entrypoint_name.split('/')[-1]
}@
# setup entrypoint
COPY ./@entrypoint_file /

ENTRYPOINT ["/@entrypoint_file"]
@[  end if]@
@[end if]@
@{
cmds = [
'bash',
]
}@
CMD ["@(' && '.join(cmds))"]
<commit_msg>don't set CMD in source template<commit_after>@(TEMPLATE(
    'snippet/add_generated_comment.Dockerfile.em',
    user_name=user_name,
    tag_name=tag_name,
    source_template_name=template_name,
))@

ARG FROM_IMAGE=osrf/ros2:devel
FROM $FROM_IMAGE
@{
template_dependencies = [
    'wget',
]
packages_to_install = []
if 'upstream_packages' in locals():
    packages_to_install = upstream_packages
if 'ros2_repo_packages' in locals():
    if ros2_repo_packages:
        packages_to_install = packages_to_install + list(set(ros2_repo_packages) - set(packages_to_install))
}@
@
@(TEMPLATE(
    'snippet/install_upstream_package_list.Dockerfile.em',
    packages=template_dependencies,
    upstream_packages=packages_to_install,
))@
@
@[if 'pip3_install' in locals()]@
@[  if pip3_install]@

# install python packages
RUN pip3 install -U \
    @(' \\\n    '.join(pip3_install))@


@[  end if]@
@[end if]@
ARG ROS_DISTRO=@ros2_distro
ENV ROS_DISTRO=$ROS_DISTRO

@
@[if 'rosdep' in locals()]@
@[  if 'rosdistro_index_url' in rosdep]@
ENV ROSDISTRO_INDEX_URL @(rosdep['rosdistro_index_url'])
RUN rosdep update

@[  end if]@
@[end if]@
@
WORKDIR $ROS2_WS
@[if 'vcs' in locals()]@
@[  if vcs]@

@(TEMPLATE(
    'snippet/vcs_import.Dockerfile.em',
    vcs=vcs,
    ws='src',
))@

@[  end if]@
@[end if]@
@
@[if 'rosdep' in locals()]@
@[  if 'install' in rosdep]@
@(TEMPLATE(
    'snippet/install_rosdep_dependencies.Dockerfile.em',
    install_args=rosdep['install'],
))@

@[  end if]@
@[else]@
RUN rosdep update &&\
    rosdep install -y \
    --from-paths src \
    --ignore-src

@[end if]@
@[if 'colcon_args' in locals()]@
@[  if colcon_args]@
# build source
RUN colcon \
    @(' \\\n    '.join(colcon_args))@

@[  end if]@
@[end if]@

ARG RUN_TESTS
ARG FAIL_ON_TEST_FAILURE
RUN if [ ! -z "$RUN_TESTS" ]; then \
        colcon test; \
        if [ ! -z "$FAIL_ON_TEST_FAILURE" ]; then \
            colcon test-result; \
        else \
            colcon test-result || true; \
        fi \
    fi
@
@[if 'entrypoint_name' in locals()]@
@[  if entrypoint_name]@
@{
entrypoint_file = entrypoint_name.split('/')[-1]
}@

# setup entrypoint
COPY ./@entrypoint_file /

ENTRYPOINT ["/@entrypoint_file"]
@[  end if]@
@[end if]@

{'fraction_non_alphanumeric': 0.16356710732691015, 'fraction_numerical': 0.004929419672865786, 'mean_word_length': 3.713833157338965, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5664239', 'n_tokens_mistral': 1845, 'n_tokens_neox': 1813, 'n_words': 351}