├── .gitignore ├── CONTRIBUTING.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── docker_templates ├── __init__.py ├── _version.py ├── argparse.py ├── collections.py ├── create.py ├── eol_distro.py ├── folders.py ├── library.py ├── packages.py └── templates │ ├── docker_images │ ├── create_base_image.Dockerfile.em │ ├── create_drcsim_image.Dockerfile.em │ ├── create_gzclient_image.Dockerfile.em │ ├── create_gzserverX_image.Dockerfile.em │ ├── create_gzserver_image.Dockerfile.em │ ├── create_gzweb_image.Dockerfile.em │ ├── create_ros_core_image.Dockerfile.em │ ├── create_ros_image.Dockerfile.em │ ├── drcsim_entrypoint.sh │ ├── gzserverX_entrypoint.sh │ ├── gzserver_entrypoint.sh │ └── ros_entrypoint.sh │ ├── docker_images_legacy │ ├── create_ros_core_image.Dockerfile.em │ └── ros_entrypoint.sh │ ├── docker_images_ros2 │ ├── create_ros_core_image.Dockerfile.em │ ├── create_ros_image.Dockerfile.em │ ├── devel │ │ ├── create_ros_image.Dockerfile.em │ │ └── ros_entrypoint.sh │ ├── nightly │ │ ├── create_ros_image.Dockerfile.em │ │ ├── create_ros_nightly_overlay.Dockerfile.em │ │ └── ros_entrypoint.sh │ ├── ros1_bridge │ │ ├── create_ros_ros1_bridge_image.Dockerfile.em │ │ └── ros_entrypoint.sh │ ├── ros_entrypoint.sh │ ├── source │ │ └── create_ros_image.Dockerfile.em │ └── testing │ │ ├── create_ros_image.Dockerfile.em │ │ └── ros_entrypoint.sh │ ├── docker_library │ ├── gazebo.em │ ├── ros.em │ └── ros2.em │ └── snippet │ ├── add_generated_comment.Dockerfile.em │ ├── check_pytest_regression.Dockerfile.em │ ├── install_ros_bootstrap_tools.Dockerfile.em │ ├── install_rosdep_dependencies.Dockerfile.em │ ├── install_upstream_package_list.Dockerfile.em │ ├── label_and_install_package_list.Dockerfile.em │ ├── setup_colcon_mixin_metadata.Dockerfile.em │ ├── setup_ros_sources.Dockerfile.em │ ├── setup_tzdata.Dockerfile.em │ └── vcs_import.Dockerfile.em ├── setup.bash ├── setup.py └── stdeb.cfg /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | dist 3 | *.egg-info 4 | __pycache__ 5 | *.pyc 6 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Any contribution that you make to this repository will 2 | be under the Apache 2 License, as dictated by that 3 | [license](http://www.apache.org/licenses/LICENSE-2.0.html): 4 | 5 | ~~~ 6 | 5. Submission of Contributions. Unless You explicitly state otherwise, 7 | any Contribution intentionally submitted for inclusion in the Work 8 | by You to the Licensor shall be under the terms and conditions of 9 | this License, without any additional terms or conditions. 10 | Notwithstanding the above, nothing herein shall supersede or modify 11 | the terms of any separate license agreement you may have executed 12 | with Licensor regarding such Contributions. 13 | ~~~ 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2014 Open Source Robotics Foundation, Inc. 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md 2 | recursive-include docker_templates/templates * 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker Base Images 2 | 3 | This repository contains the templates used to generate the Dockerfiles for the OSRF Docker Images. 4 | It also has some scripts to help maintain those images. 5 | -------------------------------------------------------------------------------- /docker_templates/__init__.py: -------------------------------------------------------------------------------- 1 | from ._version import __version__ 2 | -------------------------------------------------------------------------------- /docker_templates/_version.py: -------------------------------------------------------------------------------- 1 | # the version must be either a released version number which is also a tag name 2 | # or an upcoming version number followed by a branch name separated by a dash 3 | __version__ = '0.0.1' 4 | -------------------------------------------------------------------------------- /docker_templates/argparse.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015-2016 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import yaml 17 | 18 | from argparse import ArgumentParser 19 | 20 | class DockerfileArgParser(ArgumentParser): 21 | """Argument parser class Dockerfile auto generation""" 22 | 23 | def set(self): 24 | """Setup parser for Dockerfile auto generation""" 25 | 26 | # create the top-level parser 27 | subparsers = self.add_subparsers(help='help for subcommand', dest='subparser_name') 28 | 29 | # create the parser for the "explicit" command 30 | parser_explicit = subparsers.add_parser( 31 | 'explicit', 32 | help='explicit --help') 33 | parser_explicit.add_argument( 34 | '-p', '--platform', 35 | required=True, 36 | help="Path to platform config") 37 | parser_explicit.add_argument( 38 | '-i', '--images', 39 | required=True, 40 | help="Path to images config") 41 | parser_explicit.add_argument( 42 | '-o', '--output', 43 | required=True, 44 | help="Path to write generate Dockerfiles") 45 | 46 | # create the parser for the "dir" command 47 | parser_dir = subparsers.add_parser( 48 | 'dir', 49 | help='dir --help') 50 | parser_dir.add_argument( 51 | '-d', '--directory', 52 | required=True, 53 | help="Path to read config and write output") 54 | 55 | def parse(self, argv): 56 | args = self.parse_args(argv) 57 | 58 | # If given directory path 59 | if args.subparser_name == 'dir': 60 | platform_path = 'platform.yaml' 61 | images_path = 'images.yaml.em' 62 | args.platform = os.path.join(args.directory, platform_path) 63 | args.images = os.path.join(args.directory, images_path) 64 | args.output = args.directory 65 | 66 | return args 67 | 68 | 69 | class DockerfolderArgParser(ArgumentParser): 70 | """Argument parser class Dockerfolder auto generation""" 71 | 72 | def set(self): 73 | """Setup parser for Dockerfolder auto generation""" 74 | 75 | # create the top-level parser 76 | subparsers = self.add_subparsers(help='help for subcommand', dest='subparser_name') 77 | 78 | # create the parser for the "explicit" command 79 | parser_explicit = subparsers.add_parser( 80 | 'explicit', 81 | help='explicit --help') 82 | parser_explicit.add_argument( 83 | '-m', '--manifest', 84 | required=True, 85 | help="Path to manifest config") 86 | parser_explicit.add_argument( 87 | '-o', '--output', 88 | required=True, 89 | help="Path to write generate Dockerfiles") 90 | parser_explicit.add_argument( 91 | '-a', '--auto', 92 | action='store_true', 93 | help="Auto generate Dockerfiles files in docker folders") 94 | 95 | # create the parser for the "dir" command 96 | parser_dir = subparsers.add_parser( 97 | 'dir', 98 | help='dir --help') 99 | parser_dir.add_argument( 100 | '-d', '--directory', 101 | required=True, 102 | help="Path to read config and write output") 103 | parser_dir.add_argument( 104 | '-a', '--auto', 105 | action='store_true', 106 | help="Auto generate Dockerfiles files in docker folders") 107 | 108 | def parse(self, argv): 109 | args = self.parse_args(argv) 110 | 111 | # If given directory path 112 | if args.subparser_name == 'dir': 113 | manifest_path = 'manifest.yaml' 114 | args.manifest = os.path.join(args.directory, manifest_path) 115 | args.output = args.directory 116 | 117 | return args 118 | 119 | 120 | class DockerlibraryArgParser(ArgumentParser): 121 | """Argument parser class Dockerlibrary auto generation""" 122 | 123 | def set(self): 124 | """Setup parser for Dockerlibrary auto generation""" 125 | 126 | self.add_argument( 127 | '-m', '--manifest', 128 | required=True, 129 | help="Path to manifest config") 130 | self.add_argument( 131 | '-o', '--output', 132 | required=True, 133 | help="Path to write generate Dockerlibrary") 134 | 135 | def parse(self, argv): 136 | args = self.parse_args(argv) 137 | return args 138 | -------------------------------------------------------------------------------- /docker_templates/collections.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015-2016 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import yaml 16 | 17 | from collections import OrderedDict 18 | 19 | 20 | def OrderedLoad(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict): 21 | """Load yaml data into an OrderedDict""" 22 | class OrderedLoader(Loader): 23 | pass 24 | 25 | def construct_mapping(loader, node): 26 | loader.flatten_mapping(node) 27 | return object_pairs_hook(loader.construct_pairs(node)) 28 | OrderedLoader.add_constructor( 29 | yaml.resolver.BaseResolver.DEFAULT_MAPPING_TAG, 30 | construct_mapping) 31 | return yaml.load(stream, OrderedLoader) 32 | -------------------------------------------------------------------------------- /docker_templates/create.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015-2016 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | import pkg_resources 17 | import shutil 18 | 19 | import ros_buildfarm.templates 20 | from ros_buildfarm.templates import create_dockerfile 21 | from ros_buildfarm.templates import get_template_path 22 | from ros_buildfarm.templates import expand_template, get_wrapper_scripts 23 | 24 | default_template_prefix_path = ros_buildfarm.templates.template_prefix_path 25 | 26 | def expand_template_prefix_path(template_packages): 27 | # reset template_prefix_path 28 | ros_buildfarm.templates.template_prefix_path = default_template_prefix_path 29 | 30 | # expand template_prefix_path in order of preference 31 | for template_package in reversed(template_packages): 32 | template_package_path = pkg_resources.resource_filename( 33 | template_package, 'templates') 34 | ros_buildfarm.templates.template_prefix_path.insert( 35 | 0, template_package_path) 36 | 37 | def create_files(data, verbose=False): 38 | template_name = data['template_name'] 39 | dockerfile_dir = data['dockerfile_dir'] 40 | 41 | if 'template_packages' in data: 42 | expand_template_prefix_path(data['template_packages']) 43 | 44 | # generate Dockerfile 45 | create_dockerfile(template_name, data, dockerfile_dir, verbose) 46 | 47 | if 'entrypoint_name' in data: 48 | create_entrypoint(data) 49 | 50 | def create_entrypoint(data): 51 | # find entrypoint path 52 | entrypoint_name = data['entrypoint_name'] 53 | dockerfile_dir = data['dockerfile_dir'] 54 | entrypoint_file = os.path.basename(entrypoint_name) 55 | entrypoint_dir = os.path.dirname(get_template_path(entrypoint_name)) 56 | entrypoint_path = os.path.join(entrypoint_dir, entrypoint_file) 57 | 58 | # copy script into dockerfile_dir 59 | entrypoint_dest = os.path.join(dockerfile_dir, entrypoint_file) 60 | shutil.copyfile(entrypoint_path, entrypoint_dest) 61 | os.chmod(entrypoint_dest, 0o744) 62 | 63 | def create_dockerlibrary(template_name, data, dockerlibrary_path, verbose=False): 64 | data['template_name'] = template_name 65 | data['wrapper_scripts'] = get_wrapper_scripts() 66 | content = expand_template(template_name, data) 67 | if verbose: 68 | for line in content.splitlines(): 69 | print(' ', line) 70 | with open(dockerlibrary_path, 'w') as h: 71 | h.write(content) 72 | -------------------------------------------------------------------------------- /docker_templates/eol_distro.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 Mikael Arguedas 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | def isDistroEOL(*, ros_distro_status=None, os_distro_name=None): 17 | if ros_distro_status == "end-of-life": 18 | return True 19 | eol_base_images = [ 20 | # Ubuntu 21 | 'lucid', 22 | 'maverick', 23 | 'natty', 24 | 'oneiric', 25 | 'precise', 26 | 'quantal', 27 | 'raring', 28 | 'saucy', 29 | 'trusty', 30 | 'utopic', 31 | 'vivid', 32 | 'wily', 33 | 'yakkety', 34 | 'zesty', 35 | 'artful', 36 | 'bionic', 37 | 'cosmic', 38 | # Debian 39 | 'wheezy', 40 | 'jessie', 41 | 'stretch', 42 | 'buster', 43 | ] 44 | return os_distro_name in eol_base_images 45 | -------------------------------------------------------------------------------- /docker_templates/folders.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import string 4 | 5 | 6 | class AltTemplate(string.Template): 7 | delimiter = '@' 8 | idpattern = r'[a-z][_a-z0-9]*' 9 | 10 | 11 | def interpret_tempate(tempate, data, tempate_class=string.Template): 12 | # Read image perams using platform perams 13 | with open(tempate, 'r') as f: 14 | value = tempate_class(f.read()) 15 | 16 | value = value.substitute(data) 17 | 18 | return value 19 | 20 | 21 | def populate_path(data, path): 22 | if not os.path.exists(path): 23 | os.makedirs(path) 24 | 25 | templates = data['templates'] 26 | 27 | makefile = interpret_tempate(templates['makefile'], data) 28 | makefile_path = os.path.join(path, "Makefile") 29 | with open(makefile_path, 'w') as f: 30 | f.write(makefile) 31 | 32 | platform = interpret_tempate(templates['platform'], data) 33 | platform_path = os.path.join(path, "platform.yaml") 34 | with open(platform_path, 'w') as f: 35 | f.write(platform) 36 | 37 | shutil.copy(templates['images'], path) 38 | 39 | 40 | def populate_hooks(data, path): 41 | if not os.path.exists(path): 42 | os.makedirs(path) 43 | for hook_name, hook_tempate in data['hook_names'].items(): 44 | tags = ' '.join([data['release_name'] + '-' + data['tag_name']]) 45 | hookfile = interpret_tempate( 46 | hook_tempate, 47 | {'tags': tags, 'release_name': data['release_name']}, 48 | AltTemplate) 49 | hookfile_path = os.path.join(path, hook_name) 50 | with open(hookfile_path, 'w') as f: 51 | f.write(hookfile) 52 | os.chmod(hookfile_path, 0o744) 53 | 54 | 55 | def populate_paths(manifest, args, create_dockerfiles): 56 | # For each release 57 | for release_name, release_data in manifest['release_names'].items(): 58 | # For each os supported 59 | for os_name, os_data in release_data['os_names'].items(): 60 | # For each os distro supported 61 | for os_code_name, os_code_data in os_data['os_code_names'].items(): 62 | if os_code_data['tag_names'] is None: 63 | continue 64 | dockerfolder_dir = os.path.join(release_name, os_name, os_code_name) 65 | 66 | os_code_data['release_name'] = release_name 67 | os_code_data['os_name'] = os_name 68 | os_code_data['os_code_name'] = os_code_name 69 | 70 | populate_path(data=os_code_data, path=dockerfolder_dir) 71 | 72 | if args.auto: 73 | # Run the dockerfile generation script 74 | create_dockerfiles.main(('dir', '-d' + dockerfolder_dir)) 75 | 76 | # Hacks to add hook scripts for osrf repos 77 | if 'hacks' in manifest: 78 | # For each release 79 | for release_name, release_data in manifest['hacks'].items(): 80 | # For each os supported 81 | for os_name, os_data in release_data['os_names'].items(): 82 | # For each os distro supported 83 | for os_code_name, os_code_data in os_data['os_code_names'].items(): 84 | if os_code_data['tag_names'] is None: 85 | continue 86 | # For each tag supported: 87 | for tag_name, tag_data in os_code_data['tag_names'].items(): 88 | hooksfolder_dir = os.path.join( 89 | release_name, os_name, 90 | os_code_name, 91 | tag_name, 92 | 'hooks') 93 | tag_data['release_name'] = release_name 94 | tag_data['os_name'] = os_name 95 | tag_data['os_code_name'] = os_code_name 96 | tag_data['tag_name'] = tag_name 97 | populate_hooks(tag_data, hooksfolder_dir) 98 | -------------------------------------------------------------------------------- /docker_templates/library.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015-2016 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import git 16 | import os 17 | import string 18 | 19 | 20 | def latest_commit_sha(repo, path): 21 | """That the last commit sha for a given path in repo""" 22 | log_message = repo.git.log("-1", path) 23 | commit_sha = log_message.split('\n')[0].split(' ')[1] 24 | return commit_sha 25 | 26 | 27 | def parse_manifest(manifest, repo, repo_name): 28 | # For each release 29 | for release_name, release_data in list(manifest['release_names'].items()): 30 | print('release_name: ', release_name) 31 | # For each os supported 32 | at_least_one_tag = False 33 | for os_name, os_data in list(release_data['os_names'].items()): 34 | print('os_name: ', os_name) 35 | # For each os code name supported 36 | for os_code_name, os_code_data in list(os_data['os_code_names'].items()): 37 | print('os_code_name: ', os_code_name) 38 | if os_code_data['tag_names']: 39 | at_least_one_tag = True 40 | for tag_name, tag_data in os_code_data['tag_names'].items(): 41 | print('tag_name: ', tag_name) 42 | tags = [] 43 | for alias_pattern in tag_data['aliases']: 44 | alias_template = string.Template(alias_pattern) 45 | alias = alias_template.substitute( 46 | release_name=release_name, 47 | os_name=os_name, 48 | os_code_name=os_code_name) 49 | tags.append(alias) 50 | commit_path = os.path.join( 51 | repo_name, release_name, 52 | os_name, os_code_name, tag_name) 53 | commit_sha = latest_commit_sha(repo, commit_path) 54 | print('tags: ', tags) 55 | tag_data['Tags'] = tags 56 | tag_data['Architectures'] = os_code_data['archs'] 57 | tag_data['GitCommit'] = commit_sha 58 | tag_data['Directory'] = commit_path 59 | if not at_least_one_tag: 60 | del manifest['release_names'][release_name] 61 | 62 | return manifest 63 | -------------------------------------------------------------------------------- /docker_templates/packages.py: -------------------------------------------------------------------------------- 1 | # Copyright 2015-2016 Open Source Robotics Foundation, Inc. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import gzip 16 | import string 17 | import re 18 | import urllib.request 19 | 20 | import rosdistro 21 | 22 | from docker_templates.eol_distro import isDistroEOL 23 | 24 | # TODO: think of a better version pattern like 25 | # r'\d(?!Version\:\s)(.+)(?=(~\w+\n))' but works without a trailing ~ 26 | version_pattern = r'(?<=Version: )\d+\.\d+\.\d+\-\d+' 27 | 28 | sha256_pattern = r'(?<=SHA256: )[0-9a-f]{64}' 29 | 30 | packagePatternTemplateLookup = { 31 | 'gazebo_packages': string.Template(r'(\bPackage: $package\n)(.*?(?:\r*\n{2}))'), 32 | 'ros_packages': string.Template(r'(\bPackage: ros-$rosdistro_name-$package\n)(.*?(?:\r*\n{2}))'), 33 | 'ros2_packages': string.Template(r'(\bPackage: ros-$ros2distro_name-$package\n)(.*?(?:\r*\n{2}))'), 34 | } 35 | 36 | indexUrlTemplateLookup = { 37 | 'gazebo_packages': string.Template('http://packages.osrfoundation.org/gazebo/$os_name-$release/dists/$os_code_name/main/binary-$arch/Packages.gz'), 38 | 'ros_packages': string.Template('http://packages.ros.org/ros/ubuntu/dists/$os_code_name/main/binary-$arch/Packages.gz'), 39 | 'ros2_packages': string.Template('http://packages.ros.org/ros2/ubuntu/dists/$os_code_name/main/binary-$arch/Packages.gz'), 40 | 'ros_packages_snapshots': string.Template('http://snapshots.ros.org/$rosdistro_name/final/$os_name/dists/$os_code_name/main/binary-$arch/Packages.gz'), 41 | 'ros2_packages_snapshots': string.Template('http://snapshots.ros.org/$ros2distro_name/final/$os_name/dists/$os_code_name/main/binary-$arch/Packages.gz'), 42 | } 43 | 44 | packageVersionTemplateLookup = { 45 | 'gazebo_packages': string.Template('=$package_version*'), 46 | 'ros_packages': string.Template('=$package_version*'), 47 | 'ros2_packages': string.Template('=$package_version*'), 48 | } 49 | 50 | packageNameTemplateLookup = { 51 | 'gazebo_packages': string.Template('$package'), 52 | 'ros_packages': string.Template('ros-$rosdistro_name-$package'), 53 | 'ros2_packages': string.Template('ros-$ros2distro_name-$package'), 54 | } 55 | 56 | def getPackageIndex(data, package_index_url): 57 | """Get current online package index""" 58 | 59 | # Download package index 60 | req = urllib.request.Request(package_index_url) 61 | with urllib.request.urlopen(req) as response: 62 | package_index = gzip.decompress(response.read()).decode('utf-8') 63 | 64 | return package_index 65 | 66 | def getPackagePattern(data, package_pattern_template, package): 67 | """Get package pattern""" 68 | 69 | package_pattern_raw = package_pattern_template.substitute(data,package=package) 70 | package_pattern = re.compile(package_pattern_raw, re.DOTALL) 71 | 72 | return package_pattern 73 | 74 | def getPackageInfo(package_pattern, package_index): 75 | """Use package index to get package info""" 76 | 77 | # Parse for package info 78 | matchs = re.search(package_pattern, package_index) 79 | package_info = matchs.group(0) 80 | 81 | return package_info 82 | 83 | def getPackageSHA256(package_info): 84 | """Use package info to get package sha256""" 85 | 86 | # Parse for SHA56 87 | package_sha256 = re.search(sha256_pattern, package_info).group(0) # extract sha256 88 | 89 | return package_sha256 90 | 91 | def getPackageVersion(package_info): 92 | """Use package info to get package version""" 93 | 94 | # Parse for version_number 95 | package_version = re.search(version_pattern, package_info).group(0) # extract version_number 96 | 97 | return package_version 98 | 99 | def getPackageVersions(data, package_index, packages, package_type): 100 | """Use package index to get package versions""" 101 | 102 | package_versions = [] 103 | 104 | # Determine package_pattern 105 | package_pattern_template = packagePatternTemplateLookup[package_type] 106 | package_name_template = packageNameTemplateLookup[package_type] 107 | package_version_template = packageVersionTemplateLookup[package_type] 108 | 109 | for package in packages: 110 | package_pattern = getPackagePattern(data, package_pattern_template, package) 111 | package_name = package_name_template.substitute(data, package=package) 112 | package_info = getPackageInfo(package_pattern, package_index) 113 | package_sha256 = getPackageSHA256(package_info) 114 | 115 | if data['version'] != False: 116 | version = getPackageVersion(package_info) 117 | package_version = package_version_template.substitute(data, package_version=version) 118 | else: 119 | package_version='' 120 | 121 | package_versions.append(dict(name=package_name, version=package_version, sha256=package_sha256)) 122 | 123 | return package_versions 124 | 125 | def expandPackages(data): 126 | for package_type in indexUrlTemplateLookup: 127 | if package_type in data: 128 | # determine if distro is eol and apply the appropriate index URL template 129 | ros_distro_name = "" 130 | if package_type == "ros_packages": 131 | ros_distro_name = data["rosdistro_name"] 132 | elif package_type == "ros2_packages": 133 | ros_distro_name = data["ros2distro_name"] 134 | if ros_distro_name != "": 135 | index = rosdistro.get_index(rosdistro.get_index_url()) 136 | dist_info = index.distributions[ros_distro_name] 137 | eol = isDistroEOL( 138 | ros_distro_status=dist_info["distribution_status"], 139 | os_distro_name=data["os_code_name"], 140 | ) 141 | else: 142 | eol = isDistroEOL( 143 | ros_distro_status=None, 144 | os_distro_name=data["os_code_name"], 145 | ) 146 | if eol: 147 | package_index_url_template = indexUrlTemplateLookup[package_type + '_snapshots'] 148 | else: 149 | package_index_url_template = indexUrlTemplateLookup[package_type] 150 | package_index_url = package_index_url_template.substitute(data) 151 | package_index = getPackageIndex(data, package_index_url) 152 | package_versions = getPackageVersions(data, package_index, data[package_type], package_type) 153 | data[package_type] = package_versions 154 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/create_base_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | # generated from @template_name 2 | 3 | @(TEMPLATE( 4 | 'snippet/from_base_image.Dockerfile.em', 5 | template_packages=template_packages, 6 | os_name=os_name, 7 | os_code_name=os_code_name, 8 | arch=arch, 9 | maintainer_name=maintainer_name, 10 | ))@ 11 | 12 | @(TEMPLATE( 13 | 'snippet/add_distribution_repositories.Dockerfile.em', 14 | distribution_repository_keys=distribution_repository_keys, 15 | distribution_repository_urls=distribution_repository_urls, 16 | os_code_name=os_code_name, 17 | add_source=True, 18 | ))@ 19 | 20 | @(TEMPLATE( 21 | 'snippet/setup_tzdata.Dockerfile.em', 22 | os_name=os_name, 23 | os_code_name=os_code_name, 24 | ))@ 25 | @ 26 | @(TEMPLATE( 27 | 'snippet/install_ros_bootstrap_tools.Dockerfile.em', 28 | ros_distro=ros_distro, 29 | ))@ 30 | 31 | # setup environment 32 | ENV LANG=C.UTF-8 33 | ENV TZ=@timezone 34 | 35 | # bootstrap rosdep 36 | RUN rosdep init 37 | 38 | # install requested metapackage 39 | RUN apt-get update && apt-get install -q -y --no-install-recommends @(' '.join(packages))@ 40 | 41 | ENV ROS_DISTRO=@(rosdistro)@ 42 | # TODO source rosdistro setup file automatically on entry 43 | ENTRYPOINT ["bash", "-c"] 44 | @{ 45 | cmds = [ 46 | 'bash', 47 | ] 48 | }@ 49 | CMD ["@(' && '.join(cmds))"] 50 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/create_drcsim_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @(TEMPLATE( 17 | 'snippet/setup_tzdata.Dockerfile.em', 18 | os_name=os_name, 19 | os_code_name=os_code_name, 20 | ))@ 21 | @{ 22 | template_dependencies = [ 23 | 'dirmngr', 24 | 'gnupg2', 25 | 'lsb-release', 26 | ] 27 | }@ 28 | @(TEMPLATE( 29 | 'snippet/install_upstream_package_list.Dockerfile.em', 30 | packages=template_dependencies, 31 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 32 | ))@ 33 | 34 | # setup keys 35 | RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D2486D2DD83DB69272AFE98867170598AF249743 36 | 37 | # setup sources.list 38 | RUN . /etc/os-release \ 39 | && echo "deb http://packages.osrfoundation.org/gazebo/$ID-stable `lsb_release -sc` main" > /etc/apt/sources.list.d/gazebo-latest.list 40 | 41 | @[if 'gazebo_packages' in locals()]@ 42 | @[ if gazebo_packages]@ 43 | 44 | @(TEMPLATE( 45 | 'snippet/label_and_install_package_list.Dockerfile.em', 46 | group='gazebo', 47 | packages=gazebo_packages, 48 | ))@ 49 | @[ end if]@ 50 | @[end if]@ 51 | @[if 'entrypoint_name' in locals()]@ 52 | @[ if entrypoint_name]@ 53 | @{ 54 | entrypoint_file = entrypoint_name.split('/')[-1] 55 | }@ 56 | # setup entrypoint 57 | COPY ./@entrypoint_file / 58 | 59 | ENTRYPOINT ["/@entrypoint_file"] 60 | @[ end if]@ 61 | @[end if]@ 62 | @{ 63 | cmds = [ 64 | 'roslaunch drcsim_gazebo atlas.launch' 65 | ] 66 | }@ 67 | CMD ["@(' && '.join(cmds))"] 68 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/create_gzclient_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @(TEMPLATE( 17 | 'snippet/install_upstream_package_list.Dockerfile.em', 18 | packages=[], 19 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 20 | ))@ 21 | 22 | @(TEMPLATE( 23 | 'snippet/label_and_install_package_list.Dockerfile.em', 24 | group='gazebo', 25 | packages=gazebo_packages, 26 | ))@ 27 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/create_gzserverX_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | 17 | @(TEMPLATE( 18 | 'snippet/setup_tzdata.Dockerfile.em', 19 | os_name=os_name, 20 | os_code_name=os_code_name, 21 | ))@ 22 | @{ 23 | template_dependencies = [ 24 | 'dirmngr', 25 | 'gnupg2', 26 | 'lsb-release', 27 | 'software-properties-common', 28 | ] 29 | }@ 30 | @(TEMPLATE( 31 | 'snippet/install_upstream_package_list.Dockerfile.em', 32 | packages=template_dependencies, 33 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 34 | ))@ 35 | 36 | RUN apt-add-repository ppa:libccd-debs \ 37 | && apt-add-repository ppa:fcl-debs \ 38 | && apt-add-repository ppa:dartsim 39 | 40 | @[if 'ros_packages' in locals()]@ 41 | @[ if ros_packages]@ 42 | # ROS Setup #################################################################### 43 | # setup keys 44 | RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116 45 | 46 | # setup sources.list 47 | RUN echo "deb http://packages.ros.org/ros/ubuntu `lsb_release -sc` main" > /etc/apt/sources.list.d/ros-latest.list 48 | 49 | ENV ROS_DISTRO=@rosdistro_name 50 | @(TEMPLATE( 51 | 'snippet/install_ros_bootstrap_tools.Dockerfile.em', 52 | ros_version='1', 53 | ))@ 54 | 55 | # setup environment 56 | ENV LANG=C.UTF-8 57 | ENV LC_ALL=C.UTF-8 58 | 59 | # bootstrap rosdep 60 | RUN rosdep init \ 61 | && rosdep update 62 | 63 | @(TEMPLATE( 64 | 'snippet/label_and_install_package_list.Dockerfile.em', 65 | group='ros', 66 | packages=ros_packages, 67 | ))@ 68 | @[ end if]@ 69 | @[end if]@ 70 | 71 | @[if 'gazebo_packages' in locals()]@ 72 | @[if gazebo_packages]@ 73 | # Gazebo Setup ################################################################# 74 | # setup keys 75 | RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D2486D2DD83DB69272AFE98867170598AF249743 76 | 77 | # setup sources.list 78 | RUN . /etc/os-release \ 79 | && echo "deb http://packages.osrfoundation.org/gazebo/$ID-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-latest.list 80 | 81 | @(TEMPLATE( 82 | 'snippet/label_and_install_package_list.Dockerfile.em', 83 | group='gazebo', 84 | packages=gazebo_packages, 85 | ))@ 86 | @[end if]@ 87 | @[end if]@ 88 | 89 | @[if 'packages' in locals()]@ 90 | @[if packages]@ 91 | # install packages 92 | RUN apt-get update && apt-get install -q -y \ 93 | @(' \\\n '.join(packages))@ \ 94 | && rm -rf /var/lib/apt/lists/* 95 | @[end if]@ 96 | @[end if]@ 97 | 98 | @[if 'pip_install' in locals()]@ 99 | @[if pip_install]@ 100 | # install python packages 101 | RUN pip install \ 102 | @(' \\\n '.join(pip_install))@ 103 | 104 | @[end if]@ 105 | @[end if]@ 106 | 107 | @[if 'sources' in locals()]@ 108 | @[if sources]@ 109 | # clone source 110 | RUN mkdir -p @(ws)/src 111 | @(TEMPLATE( 112 | 'snippet/clone_sources.Dockerfile.em', 113 | sources=sources, 114 | ws=ws, 115 | ))@ 116 | 117 | # build source 118 | WORKDIR @(ws) 119 | RUN catkin init \ 120 | && catkin build \ 121 | -vi \ 122 | --cmake-args \ 123 | @(' \\\n '.join(cmake_args))@ 124 | 125 | @[end if]@ 126 | @[end if]@ 127 | 128 | # setup environment 129 | EXPOSE 11345 130 | 131 | @[if 'entrypoint_name' in locals()]@ 132 | @[if entrypoint_name]@ 133 | @{ 134 | entrypoint_file = entrypoint_name.split('/')[-1] 135 | }@ 136 | # setup entrypoint 137 | COPY ./@entrypoint_file / 138 | 139 | ENTRYPOINT ["/@entrypoint_file"] 140 | @[end if]@ 141 | @[end if]@ 142 | @{ 143 | cmds = [ 144 | 'gzserver', 145 | ] 146 | }@ 147 | CMD ["@(' && '.join(cmds))"] 148 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/create_gzserver_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @(TEMPLATE( 17 | 'snippet/setup_tzdata.Dockerfile.em', 18 | os_name=os_name, 19 | os_code_name=os_code_name, 20 | ))@ 21 | @{ 22 | template_dependencies = [ 23 | 'dirmngr', 24 | 'gnupg2', 25 | ] 26 | }@ 27 | @(TEMPLATE( 28 | 'snippet/install_upstream_package_list.Dockerfile.em', 29 | packages=template_dependencies, 30 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 31 | ))@ 32 | 33 | 34 | # setup keys 35 | RUN set -eux; \ 36 | key='D2486D2DD83DB69272AFE98867170598AF249743'; \ 37 | export GNUPGHOME="$(mktemp -d)"; \ 38 | gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ 39 | mkdir -p /usr/share/keyrings; \ 40 | gpg --batch --export "$key" > /usr/share/keyrings/pkgs-osrf-archive-keyring.gpg; \ 41 | gpgconf --kill all; \ 42 | rm -rf "$GNUPGHOME" 43 | 44 | # setup sources.list 45 | RUN . /etc/os-release \ 46 | && echo "deb [ signed-by=/usr/share/keyrings/pkgs-osrf-archive-keyring.gpg ] http://packages.osrfoundation.org/gazebo/$ID-stable $VERSION_CODENAME main" > /etc/apt/sources.list.d/gazebo-latest.list 47 | 48 | @(TEMPLATE( 49 | 'snippet/label_and_install_package_list.Dockerfile.em', 50 | group='gazebo', 51 | packages=gazebo_packages, 52 | ))@ 53 | # setup environment 54 | EXPOSE 11345 55 | 56 | @[if 'entrypoint_name' in locals()]@ 57 | @[ if entrypoint_name]@ 58 | @{ 59 | entrypoint_file = entrypoint_name.split('/')[-1] 60 | }@ 61 | # setup entrypoint 62 | COPY ./@entrypoint_file / 63 | 64 | ENTRYPOINT ["/@entrypoint_file"] 65 | @[ end if]@ 66 | @[end if]@ 67 | @{ 68 | cmds = [ 69 | 'gzserver', 70 | ] 71 | }@ 72 | CMD ["@(' && '.join(cmds))"] 73 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/create_gzweb_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @{ 17 | template_dependencies = [ 18 | 'mercurial', 19 | ] 20 | }@ 21 | @(TEMPLATE( 22 | 'snippet/install_upstream_package_list.Dockerfile.em', 23 | packages=template_dependencies, 24 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 25 | ))@ 26 | 27 | @(TEMPLATE( 28 | 'snippet/label_and_install_package_list.Dockerfile.em', 29 | group='gazebo', 30 | packages=gazebo_packages, 31 | ))@ 32 | # clone gzweb 33 | ENV GZWEB_WS=/root/gzweb 34 | RUN hg clone https://bitbucket.org/osrf/gzweb $GZWEB_WS 35 | WORKDIR $GZWEB_WS 36 | 37 | # build gzweb 38 | RUN hg up default \ 39 | && xvfb-run -s "-screen 0 1280x1024x24" ./deploy.sh -m -t 40 | 41 | # setup environment 42 | EXPOSE 8080 43 | EXPOSE 7681 44 | 45 | # run gzserver and gzweb 46 | @{ 47 | cmds = [ 48 | 'gzserver --verbose', 49 | 'npm start', 50 | ] 51 | }@ 52 | CMD @(' & '.join(cmds)) 53 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/create_ros_core_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @(TEMPLATE( 17 | 'snippet/old_release_set.Dockerfile.em', 18 | template_packages=template_packages, 19 | os_name=os_name, 20 | os_code_name=os_code_name, 21 | ))@ 22 | @ 23 | @(TEMPLATE( 24 | 'snippet/setup_tzdata.Dockerfile.em', 25 | os_name=os_name, 26 | os_code_name=os_code_name, 27 | ))@ 28 | @ 29 | @{ 30 | template_dependencies = [ 31 | 'ca-certificates', 32 | 'curl', 33 | 'dirmngr', 34 | 'gnupg2', 35 | ] 36 | }@ 37 | @(TEMPLATE( 38 | 'snippet/install_upstream_package_list.Dockerfile.em', 39 | packages=template_dependencies, 40 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 41 | ))@ 42 | 43 | @(TEMPLATE( 44 | 'snippet/setup_ros_sources.Dockerfile.em', 45 | os_name=os_name, 46 | os_code_name=os_code_name, 47 | ros_distro=rosdistro_name, 48 | ))@ 49 | 50 | # setup environment 51 | ENV LANG=C.UTF-8 52 | ENV LC_ALL=C.UTF-8 53 | 54 | ENV ROS_DISTRO=@rosdistro_name 55 | 56 | @(TEMPLATE( 57 | 'snippet/label_and_install_package_list.Dockerfile.em', 58 | group='ros', 59 | packages=ros_packages, 60 | ))@ 61 | @[if 'entrypoint_name' in locals()]@ 62 | @[ if entrypoint_name]@ 63 | @{ 64 | entrypoint_file = entrypoint_name.split('/')[-1] 65 | }@ 66 | # setup entrypoint 67 | COPY ./@entrypoint_file / 68 | 69 | ENTRYPOINT ["/@entrypoint_file"] 70 | @[ end if]@ 71 | @[end if]@ 72 | @{ 73 | cmds = [ 74 | 'bash', 75 | ] 76 | }@ 77 | CMD ["@(' && '.join(cmds))"] 78 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/create_ros_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | 17 | @(TEMPLATE( 18 | 'snippet/install_upstream_package_list.Dockerfile.em', 19 | packages=[], 20 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 21 | ))@ 22 | @ 23 | @[if 'bootstrap_ros_tools' in locals()]@ 24 | @(TEMPLATE( 25 | 'snippet/install_ros_bootstrap_tools.Dockerfile.em', 26 | ros_distro=rosdistro_name, 27 | os_code_name=os_code_name, 28 | ))@ 29 | 30 | # bootstrap rosdep 31 | RUN rosdep init && \ 32 | rosdep update --rosdistro $ROS_DISTRO 33 | 34 | @[end if]@ 35 | @ 36 | @[if 'ros_packages' in locals()]@ 37 | @[ if ros_packages]@ 38 | @(TEMPLATE( 39 | 'snippet/label_and_install_package_list.Dockerfile.em', 40 | group='ros', 41 | packages=ros_packages, 42 | ))@ 43 | @[ end if]@ 44 | @[end if]@ 45 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/drcsim_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # setup gazebo environment 5 | source "/usr/share/drcsim/setup.sh" 6 | exec "$@" 7 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/gzserverX_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # setup gazebo environment 5 | source ${WS}/devel/setup.bash 6 | exec "$@" 7 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/gzserver_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # setup gazebo environment 5 | source "/usr/share/gazebo/setup.sh" 6 | exec "$@" 7 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images/ros_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # setup ros environment 5 | source "/opt/ros/$ROS_DISTRO/setup.bash" -- 6 | exec "$@" 7 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_legacy/create_ros_core_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | 17 | @(TEMPLATE( 18 | 'snippet/old_release_set.Dockerfile.em', 19 | template_packages=template_packages, 20 | os_name=os_name, 21 | os_code_name=os_code_name, 22 | ))@ 23 | 24 | @[if 'packages' in locals()]@ 25 | @[ if packages]@ 26 | 27 | # install packages 28 | RUN apt-get update && apt-get install -y --no-install-recommends \ 29 | @(' \\\n '.join(packages))@ \ 30 | && rm -rf /var/lib/apt/lists/* \ 31 | && mkdir /var/lib/apt/lists/partial 32 | 33 | @[ end if]@ 34 | @[end if]@ 35 | @ 36 | @(TEMPLATE( 37 | 'snippet/setup_ros_sources.Dockerfile.em', 38 | os_name=os_name, 39 | os_code_name=os_code_name, 40 | rosdistro_name=rosdistro_name, 41 | ros_version=ros_version, 42 | ))@ 43 | 44 | # setup environment 45 | RUN locale-gen en_US.UTF-8 46 | ENV LANG=en_US.UTF-8 47 | 48 | # install ros packages 49 | ENV ROS_DISTRO=@rosdistro_name 50 | RUN apt-get update && apt-get install -y \ 51 | @(' \\\n '.join('{name}{version}'.format(**p) for p in ros_packages))@ \ 52 | && rm -rf /var/lib/apt/lists/* \ 53 | && mkdir /var/lib/apt/lists/partial 54 | 55 | @[if 'entrypoint_name' in locals()]@ 56 | @[ if entrypoint_name]@ 57 | @{ 58 | entrypoint_file = entrypoint_name.split('/')[-1] 59 | }@ 60 | # setup entrypoint 61 | COPY ./@entrypoint_file /ros_entrypoint.sh 62 | 63 | ENTRYPOINT ["/ros_entrypoint.sh"] 64 | @[ end if]@ 65 | @[end if]@ 66 | @{ 67 | cmds = [ 68 | 'bash', 69 | ] 70 | }@ 71 | CMD ["@(' && '.join(cmds))"] 72 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_legacy/ros_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | SETUP_BASH="/opt/ros/$ROS_DISTRO/setup.bash" 5 | SETUP_SH="/opt/ros/$ROS_DISTRO/setup.sh" 6 | 7 | # setup ros environment 8 | if [ ! -f $SETUP_BASH ] 9 | then 10 | source $SETUP_SH 11 | else 12 | source $SETUP_BASH 13 | fi 14 | 15 | exec "$@" 16 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/create_ros_core_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @(TEMPLATE( 17 | 'snippet/old_release_set.Dockerfile.em', 18 | template_packages=template_packages, 19 | os_name=os_name, 20 | os_code_name=os_code_name, 21 | ))@ 22 | @ 23 | @(TEMPLATE( 24 | 'snippet/setup_tzdata.Dockerfile.em', 25 | os_name=os_name, 26 | os_code_name=os_code_name, 27 | ))@ 28 | @ 29 | @{ 30 | template_dependencies = [ 31 | 'ca-certificates', 32 | 'curl', 33 | 'dirmngr', 34 | 'gnupg2', 35 | ] 36 | # add 'python3-pip' to 'template_dependencies' if pip dependencies are declared 37 | if 'pip3_install' in locals(): 38 | if isinstance(pip3_install, list) and pip3_install != []: 39 | template_dependencies.append('python3-pip') 40 | }@ 41 | @(TEMPLATE( 42 | 'snippet/install_upstream_package_list.Dockerfile.em', 43 | packages=template_dependencies, 44 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 45 | ))@ 46 | 47 | @(TEMPLATE( 48 | 'snippet/setup_ros_sources.Dockerfile.em', 49 | os_name=os_name, 50 | os_code_name=os_code_name, 51 | ros_distro=ros2distro_name, 52 | ))@ 53 | 54 | # setup environment 55 | ENV LANG=C.UTF-8 56 | ENV LC_ALL=C.UTF-8 57 | 58 | ENV ROS_DISTRO=@ros2distro_name 59 | 60 | @[if 'pip3_install' in locals()]@ 61 | @[ if pip3_install]@ 62 | # install python packages 63 | RUN pip3 install -U \ 64 | @(' \\\n '.join(pip3_install))@ 65 | 66 | @[ end if]@ 67 | @[end if]@ 68 | @ 69 | @(TEMPLATE( 70 | 'snippet/label_and_install_package_list.Dockerfile.em', 71 | group='ros2', 72 | packages=ros2_packages, 73 | ))@ 74 | @[if 'entrypoint_name' in locals()]@ 75 | @[ if entrypoint_name]@ 76 | @{ 77 | entrypoint_file = entrypoint_name.split('/')[-1] 78 | }@ 79 | # setup entrypoint 80 | COPY ./@entrypoint_file / 81 | 82 | ENTRYPOINT ["/@entrypoint_file"] 83 | @[ end if]@ 84 | @[end if]@ 85 | @{ 86 | cmds = [ 87 | 'bash', 88 | ] 89 | }@ 90 | CMD ["@(' && '.join(cmds))"] 91 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/create_ros_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | 17 | @{ 18 | template_dependencies = [] 19 | # add 'python3-pip' to 'template_dependencies' if pip dependencies are declared 20 | if 'pip3_install' in locals(): 21 | if isinstance(pip3_install, list) and pip3_install != []: 22 | template_dependencies.append('python3-pip') 23 | }@ 24 | @(TEMPLATE( 25 | 'snippet/install_upstream_package_list.Dockerfile.em', 26 | packages=template_dependencies, 27 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 28 | ))@ 29 | @ 30 | @[if 'bootstrap_ros_tools' in locals()]@ 31 | @(TEMPLATE( 32 | 'snippet/install_ros_bootstrap_tools.Dockerfile.em', 33 | ros_distro=ros2distro_name, 34 | ))@ 35 | 36 | # bootstrap rosdep 37 | RUN rosdep init && \ 38 | rosdep update --rosdistro $ROS_DISTRO 39 | 40 | @(TEMPLATE( 41 | 'snippet/setup_colcon_mixin_metadata.Dockerfile.em', 42 | ))@ 43 | 44 | @[end if]@ 45 | @ 46 | @[if 'pip3_install' in locals()]@ 47 | @[ if pip3_install]@ 48 | # install python packages 49 | RUN pip3 install -U \ 50 | @(' \\\n '.join(pip3_install))@ 51 | 52 | @[ end if]@ 53 | @[end if]@ 54 | @[if 'ros2_packages' in locals()]@ 55 | @(TEMPLATE( 56 | 'snippet/label_and_install_package_list.Dockerfile.em', 57 | group='ros2', 58 | packages=ros2_packages, 59 | ))@ 60 | @[end if]@ 61 | @[if 'entrypoint_name' in locals()]@ 62 | @[ if entrypoint_name]@ 63 | @{ 64 | entrypoint_file = entrypoint_name.split('/')[-1] 65 | }@ 66 | # setup entrypoint 67 | COPY ./@entrypoint_file / 68 | 69 | ENTRYPOINT ["/@entrypoint_file"] 70 | @{ 71 | cmds = [ 72 | 'bash', 73 | ] 74 | }@ 75 | CMD ["@(' && '.join(cmds))"] 76 | @[ end if]@ 77 | @[end if]@ 78 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/devel/create_ros_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | ARG FROM_IMAGE=@base_image 8 | FROM $FROM_IMAGE 9 | @(TEMPLATE( 10 | 'snippet/setup_tzdata.Dockerfile.em', 11 | os_name=os_name, 12 | os_code_name=os_code_name, 13 | ))@ 14 | @{ 15 | template_dependencies = [ 16 | 'ca-certificates', 17 | 'curl', 18 | 'dirmngr', 19 | 'gnupg2', 20 | ] 21 | # add 'python3-pip' to 'template_dependencies' if pip dependencies are declared 22 | if 'pip3_install' in locals(): 23 | if isinstance(pip3_install, list) and pip3_install != []: 24 | template_dependencies.append('python3-pip') 25 | }@ 26 | @(TEMPLATE( 27 | 'snippet/install_upstream_package_list.Dockerfile.em', 28 | packages=template_dependencies, 29 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 30 | ))@ 31 | 32 | @(TEMPLATE( 33 | 'snippet/setup_ros_sources.Dockerfile.em', 34 | os_name=os_name, 35 | os_code_name=os_code_name, 36 | ros_distro='rolling', 37 | ))@ 38 | 39 | # setup environment 40 | ENV LANG=C.UTF-8 41 | ENV LC_ALL=C.UTF-8 42 | 43 | @(TEMPLATE( 44 | 'snippet/install_ros_bootstrap_tools.Dockerfile.em', 45 | ros_distro='rolling', 46 | ))@ 47 | 48 | @[if 'ros2_repo_packages' in locals()]@ 49 | @[ if ros2_repo_packages]@ 50 | # install packages from the ROS repositories 51 | RUN apt-get update && apt-get install -y --no-install-recommends \ 52 | @(' \\\n '.join(sorted(ros2_repo_packages)))@ \ 53 | && rm -rf /var/lib/apt/lists/* 54 | 55 | @[ end if]@ 56 | @[end if]@ 57 | @ 58 | @[if 'pip3_install' in locals()]@ 59 | @[ if pip3_install]@ 60 | # install python packages 61 | RUN pip3 install -U \ 62 | @(' \\\n '.join(pip3_install))@ 63 | 64 | @[ end if]@ 65 | @[end if]@ 66 | @(TEMPLATE( 67 | 'snippet/check_pytest_regression.Dockerfile.em', 68 | ))@ 69 | @ 70 | # bootstrap rosdep 71 | @[if 'rosdep' in locals()]@ 72 | @[ if 'rosdistro_index_url' in rosdep]@ 73 | ENV ROSDISTRO_INDEX_URL=@(rosdep['rosdistro_index_url']) 74 | @[ end if]@ 75 | @[end if]@ 76 | RUN rosdep init \ 77 | && rosdep update 78 | 79 | @(TEMPLATE( 80 | 'snippet/setup_colcon_mixin_metadata.Dockerfile.em', 81 | ))@ 82 | 83 | # clone source 84 | ENV ROS2_WS=@(ws) 85 | RUN mkdir -p $ROS2_WS/src 86 | WORKDIR $ROS2_WS 87 | 88 | # build source 89 | RUN colcon \ 90 | build \ 91 | --cmake-args \ 92 | -DSECURITY=ON --no-warn-unused-cli \ 93 | --symlink-install 94 | 95 | # setup bashrc 96 | RUN cp /etc/skel/.bashrc ~/ 97 | 98 | @[if 'entrypoint_name' in locals()]@ 99 | @[ if entrypoint_name]@ 100 | @{ 101 | entrypoint_file = entrypoint_name.split('/')[-1] 102 | }@ 103 | # setup entrypoint 104 | COPY ./@entrypoint_file / 105 | 106 | ENTRYPOINT ["/@entrypoint_file"] 107 | @[ end if]@ 108 | @[end if]@ 109 | @{ 110 | cmds = [ 111 | 'bash', 112 | ] 113 | }@ 114 | CMD ["@(' && '.join(cmds))"] 115 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/devel/ros_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # setup ros2 environment 5 | source "$ROS2_WS/install/setup.bash" -- 6 | exec "$@" 7 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/nightly/create_ros_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @(TEMPLATE( 17 | 'snippet/setup_tzdata.Dockerfile.em', 18 | os_name=os_name, 19 | os_code_name=os_code_name, 20 | ))@ 21 | @{ 22 | template_dependencies = [ 23 | 'ca-certificates', 24 | 'cmake', 25 | 'curl', 26 | 'dirmngr', 27 | 'git', 28 | 'gnupg2', 29 | 'wget', 30 | ] 31 | # add 'python3-pip' to 'template_dependencies' if pip dependencies are declared 32 | if 'pip3_install' in locals(): 33 | if isinstance(pip3_install, list) and pip3_install != []: 34 | template_dependencies.append('python3-pip') 35 | }@ 36 | @(TEMPLATE( 37 | 'snippet/install_upstream_package_list.Dockerfile.em', 38 | packages=template_dependencies, 39 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 40 | ))@ 41 | 42 | @(TEMPLATE( 43 | 'snippet/setup_ros_sources.Dockerfile.em', 44 | os_name=os_name, 45 | os_code_name=os_code_name, 46 | ros_distro=ros2distro_name, 47 | ))@ 48 | 49 | @(TEMPLATE( 50 | 'snippet/install_ros_bootstrap_tools.Dockerfile.em', 51 | ros_distro=ros2distro_name, 52 | ))@ 53 | 54 | # setup environment 55 | ENV ROS_DISTRO=@ros2distro_name 56 | @[if 'env_before' in locals()]@ 57 | @[ for env_var, env_val in env_before.items()]@ 58 | ENV @(env_var)=@(env_val) 59 | @[ end for]@ 60 | 61 | @[end if]@ 62 | @[if 'pip3_install' in locals()]@ 63 | @[ if pip3_install]@ 64 | # install python packages 65 | RUN pip3 install -U \ 66 | @(' \\\n '.join(pip3_install))@ 67 | 68 | @[ end if]@ 69 | @[end if]@ 70 | @(TEMPLATE( 71 | 'snippet/check_pytest_regression.Dockerfile.em', 72 | ))@ 73 | @ 74 | # install ros2 packages 75 | RUN mkdir -p /opt/ros/$ROS_DISTRO 76 | ARG ROS2_BINARY_URL=@ros2_binary_url 77 | RUN wget -q $ROS2_BINARY_URL -O - | \ 78 | tar -xj --strip-components=1 -C /opt/ros/$ROS_DISTRO 79 | 80 | # Overwriting _colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX to point to the new install location 81 | # Necessary because the default value is an absolute path valid only on the build machine 82 | RUN sed -i "s|^\(_colcon_prefix_chain_sh_COLCON_CURRENT_PREFIX\s*=\s*\).*$|\1/opt/ros/$ROS_DISTRO|" \ 83 | /opt/ros/$ROS_DISTRO/setup.sh 84 | 85 | @(TEMPLATE( 86 | 'snippet/setup_colcon_mixin_metadata.Dockerfile.em', 87 | ))@ 88 | 89 | @[if 'rosdep' in locals()]@ 90 | # bootstrap rosdep 91 | RUN rosdep init 92 | 93 | @[ if 'override_rule_files' in rosdep]@ 94 | # add custom rosdep rule files 95 | @[ for rule_file in rosdep['override_rule_files']]@ 96 | COPY @rule_file /etc/ros/rosdep/ 97 | RUN echo "yaml file:///etc/ros/rosdep/@rule_file" | \ 98 | cat - /etc/ros/rosdep/sources.list.d/20-default.list > temp && \ 99 | mv temp /etc/ros/rosdep/sources.list.d/20-default.list 100 | @[ end for]@ 101 | @[ end if]@ 102 | RUN rosdep update 103 | 104 | @{ 105 | if 'path' not in rosdep: 106 | rosdep['path']='/opt/ros/$ROS_DISTRO/share' 107 | }@ 108 | # install dependencies 109 | RUN . /opt/ros/$ROS_DISTRO/setup.sh \ 110 | && apt-get update \ 111 | && rosdep install -y \ 112 | --from-paths @(rosdep['path']) \ 113 | --ignore-src \ 114 | --skip-keys " \ 115 | @(' \\\n '.join(rosdep['skip_keys']))@ " \ 116 | && rm -rf /var/lib/apt/lists/* 117 | 118 | @[end if]@ 119 | @ 120 | @[if 'env_after' in locals()]@ 121 | # setup environment 122 | @[ for env_var, env_val in env_after.items()]@ 123 | ENV @(env_var)=@(env_val) 124 | @[ end for]@ 125 | 126 | @[end if]@ 127 | @ 128 | @[if 'entrypoint_name' in locals()]@ 129 | @[ if entrypoint_name]@ 130 | @{ 131 | entrypoint_file = entrypoint_name.split('/')[-1] 132 | }@ 133 | # setup entrypoint 134 | COPY ./@entrypoint_file / 135 | 136 | ENTRYPOINT ["/@entrypoint_file"] 137 | @[ end if]@ 138 | @[end if]@ 139 | @{ 140 | cmds = [ 141 | 'bash', 142 | ] 143 | }@ 144 | CMD ["@(' && '.join(cmds))"] 145 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/nightly/create_ros_nightly_overlay.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @{ 17 | template_dependencies = [] 18 | # add 'python3-pip' to 'template_dependencies' if pip dependencies are declared 19 | if 'pip3_install' in locals(): 20 | if isinstance(pip3_install, list) and pip3_install != []: 21 | template_dependencies.append('python3-pip') 22 | }@ 23 | @[if 'env_before' in locals()]@ 24 | 25 | @[ for env_var, env_val in env_before.items()]@ 26 | ENV @(env_var)=@(env_val) 27 | @[ end for]@ 28 | @[end if]@ 29 | @(TEMPLATE( 30 | 'snippet/install_upstream_package_list.Dockerfile.em', 31 | packages=template_dependencies, 32 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 33 | ))@ 34 | @ 35 | 36 | @[if 'pip3_install' in locals()]@ 37 | @[ if pip3_install]@ 38 | # install python packages 39 | RUN pip3 install -U \ 40 | @(' \\\n '.join(pip3_install))@ 41 | 42 | @[ end if]@ 43 | @[end if]@ 44 | @ 45 | @[if 'rosdep' in locals()]@ 46 | # bootstrap rosdep 47 | RUN rosdep update 48 | 49 | @{ 50 | if 'path' not in rosdep: 51 | rosdep['path'] = '/opt/ros/$ROS_DISTRO/share' 52 | if 'skip_keys' not in rosdep: 53 | rosdep['skip_keys'] = [] 54 | }@ 55 | # install dependencies 56 | RUN . /opt/ros/$ROS_DISTRO/setup.sh \ 57 | && apt-get update \ 58 | && rosdep install -y \ 59 | --from-paths @(rosdep['path']) \ 60 | --ignore-src \ 61 | --skip-keys " \ 62 | @(' \\\n '.join(rosdep['skip_keys']))@ " \ 63 | && rm -rf /var/lib/apt/lists/* 64 | 65 | @[end if]@ 66 | @ 67 | @[if 'env_after' in locals()]@ 68 | 69 | # set up environment 70 | @[ for env_var, env_val in env_after.items()]@ 71 | ENV @(env_var)=@(env_val) 72 | @[ end for]@ 73 | @[end if]@ 74 | @[if 'entrypoint_name' in locals()]@ 75 | @[ if entrypoint_name]@ 76 | @{ 77 | entrypoint_file = entrypoint_name.split('/')[-1] 78 | }@ 79 | # setup entrypoint 80 | COPY ./@entrypoint_file / 81 | 82 | ENTRYPOINT ["/@entrypoint_file"] 83 | @[ end if]@ 84 | @[end if]@ 85 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/nightly/ros_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # setup ros2 environment 5 | source "/opt/ros/$ROS_DISTRO/setup.bash" -- 6 | exec "$@" 7 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/ros1_bridge/create_ros_ros1_bridge_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | @(TEMPLATE( 8 | 'snippet/from_base_image.Dockerfile.em', 9 | template_packages=template_packages, 10 | os_name=os_name, 11 | os_code_name=os_code_name, 12 | arch=arch, 13 | base_image=base_image, 14 | maintainer_name=maintainer_name, 15 | ))@ 16 | @{ 17 | template_dependencies = [ 18 | 'ca-certificates', 19 | 'curl', 20 | ] 21 | # add 'python3-pip' to 'template_dependencies' if pip dependencies are declared 22 | if 'pip3_install' in locals(): 23 | if isinstance(pip3_install, list) and pip3_install != []: 24 | template_dependencies.append('python3-pip') 25 | }@ 26 | @(TEMPLATE( 27 | 'snippet/install_upstream_package_list.Dockerfile.em', 28 | packages=template_dependencies, 29 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 30 | ))@ 31 | @ 32 | @[if 'pip3_install' in locals()]@ 33 | @[ if pip3_install]@ 34 | # install python packages 35 | RUN pip3 install -U \ 36 | @(' \\\n '.join(pip3_install))@ 37 | 38 | @[ end if]@ 39 | @[end if]@ 40 | 41 | @(TEMPLATE( 42 | 'snippet/setup_ros_sources.Dockerfile.em', 43 | os_name=os_name, 44 | os_code_name=os_code_name, 45 | ros_distro=rosdistro_name, 46 | ))@ 47 | 48 | ENV ROS1_DISTRO=@rosdistro_name 49 | ENV ROS2_DISTRO=@ros2distro_name 50 | 51 | @[if 'ros_packages' in locals()]@ 52 | @(TEMPLATE( 53 | 'snippet/label_and_install_package_list.Dockerfile.em', 54 | group='ros', 55 | packages=ros_packages, 56 | ))@ 57 | @[end if]@ 58 | @[if 'ros2_packages' in locals()]@ 59 | @(TEMPLATE( 60 | 'snippet/label_and_install_package_list.Dockerfile.em', 61 | group='ros2', 62 | packages=ros2_packages, 63 | ))@ 64 | @[end if]@ 65 | @[if 'downstream_packages' in locals()]@ 66 | @[ if downstream_packages]@ 67 | # install downstream packages 68 | RUN apt-get update && apt-get install -y --no-install-recommends \ 69 | @(' \\\n '.join(downstream_packages))@ \ 70 | && rm -rf /var/lib/apt/lists/* 71 | 72 | @[ end if]@ 73 | @[end if]@ 74 | @[if 'entrypoint_name' in locals()]@ 75 | @[ if entrypoint_name]@ 76 | @{ 77 | entrypoint_file = entrypoint_name.split('/')[-1] 78 | }@ 79 | # setup entrypoint 80 | COPY ./@entrypoint_file / 81 | @[ end if]@ 82 | @[end if]@ 83 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/ros1_bridge/ros_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # unsetting ROS_DISTRO to silence ROS_DISTRO override warning 5 | unset ROS_DISTRO 6 | # setup ros1 environment 7 | source "/opt/ros/$ROS1_DISTRO/setup.bash" -- 8 | 9 | # unsetting ROS_DISTRO to silence ROS_DISTRO override warning 10 | unset ROS_DISTRO 11 | # setup ros2 environment 12 | source "/opt/ros/$ROS2_DISTRO/setup.bash" -- 13 | 14 | exec "$@" 15 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/ros_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # setup ros2 environment 5 | source "/opt/ros/$ROS_DISTRO/setup.bash" -- 6 | exec "$@" 7 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/source/create_ros_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | 8 | ARG FROM_IMAGE=osrf/ros2:devel 9 | FROM $FROM_IMAGE 10 | @{ 11 | template_dependencies = [ 12 | 'wget', 13 | ] 14 | packages_to_install = [] 15 | if 'upstream_packages' in locals(): 16 | packages_to_install = upstream_packages 17 | if 'ros2_repo_packages' in locals(): 18 | if ros2_repo_packages: 19 | packages_to_install = packages_to_install + list(set(ros2_repo_packages) - set(packages_to_install)) 20 | }@ 21 | @ 22 | @(TEMPLATE( 23 | 'snippet/install_upstream_package_list.Dockerfile.em', 24 | packages=template_dependencies, 25 | upstream_packages=packages_to_install, 26 | ))@ 27 | @ 28 | @[if 'pip3_install' in locals()]@ 29 | @[ if pip3_install]@ 30 | 31 | # install python packages 32 | RUN pip3 install -U \ 33 | @(' \\\n '.join(pip3_install))@ 34 | 35 | 36 | @[ end if]@ 37 | @[end if]@ 38 | ARG ROS_DISTRO=@ros2_distro 39 | ENV ROS_DISTRO=$ROS_DISTRO 40 | ENV ROS_VERSION=2 \ 41 | ROS_PYTHON_VERSION=3 42 | 43 | @ 44 | @[if 'rosdep' in locals()]@ 45 | @[ if 'rosdistro_index_url' in rosdep]@ 46 | ENV ROSDISTRO_INDEX_URL=@(rosdep['rosdistro_index_url']) 47 | RUN rosdep update --rosdistro $ROS_DISTRO 48 | 49 | @[ end if]@ 50 | @[end if]@ 51 | @ 52 | WORKDIR $ROS2_WS 53 | @[if 'vcs' in locals()]@ 54 | @[ if vcs]@ 55 | 56 | @(TEMPLATE( 57 | 'snippet/vcs_import.Dockerfile.em', 58 | vcs=vcs, 59 | ws='src', 60 | ))@ 61 | 62 | @[ end if]@ 63 | @[end if]@ 64 | @ 65 | @[if 'rosdep' in locals()]@ 66 | @[ if 'install' in rosdep]@ 67 | @(TEMPLATE( 68 | 'snippet/install_rosdep_dependencies.Dockerfile.em', 69 | install_args=rosdep['install'], 70 | ))@ 71 | 72 | @[ end if]@ 73 | @[else]@ 74 | RUN rosdep update --rosdistro $ROS_DISTRO && \ 75 | rosdep install -y \ 76 | --from-paths src \ 77 | --ignore-src 78 | 79 | @[end if]@ 80 | @[if 'colcon_args' in locals()]@ 81 | @[ if colcon_args]@ 82 | # build source 83 | RUN colcon \ 84 | @(' \\\n '.join(colcon_args))@ 85 | 86 | @[ end if]@ 87 | @[end if]@ 88 | 89 | ARG RUN_TESTS 90 | ARG FAIL_ON_TEST_FAILURE 91 | RUN if [ ! -z "$RUN_TESTS" ]; then \ 92 | colcon test; \ 93 | if [ ! -z "$FAIL_ON_TEST_FAILURE" ]; then \ 94 | colcon test-result; \ 95 | else \ 96 | colcon test-result || true; \ 97 | fi \ 98 | fi 99 | @ 100 | @[if 'entrypoint_name' in locals()]@ 101 | @[ if entrypoint_name]@ 102 | @{ 103 | entrypoint_file = entrypoint_name.split('/')[-1] 104 | }@ 105 | 106 | # setup entrypoint 107 | COPY ./@entrypoint_file / 108 | 109 | ENTRYPOINT ["/@entrypoint_file"] 110 | @[ end if]@ 111 | @[end if]@ 112 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/testing/create_ros_image.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @(TEMPLATE( 2 | 'snippet/add_generated_comment.Dockerfile.em', 3 | user_name=user_name, 4 | tag_name=tag_name, 5 | source_template_name=template_name, 6 | ))@ 7 | ARG FROM_IMAGE=@base_image 8 | FROM $FROM_IMAGE 9 | @(TEMPLATE( 10 | 'snippet/setup_tzdata.Dockerfile.em', 11 | os_name=os_name, 12 | os_code_name=os_code_name, 13 | ))@ 14 | @{ 15 | template_dependencies = [ 16 | 'ca-certificates', 17 | 'curl', 18 | 'dirmngr', 19 | 'gnupg2', 20 | ] 21 | # add 'python3-pip' to 'template_dependencies' if pip dependencies are declared 22 | if 'pip3_install' in locals(): 23 | if isinstance(pip3_install, list) and pip3_install != []: 24 | template_dependencies.append('python3-pip') 25 | }@ 26 | @(TEMPLATE( 27 | 'snippet/install_upstream_package_list.Dockerfile.em', 28 | packages=template_dependencies, 29 | upstream_packages=upstream_packages if 'upstream_packages' in locals() else [], 30 | ))@ 31 | 32 | @(TEMPLATE( 33 | 'snippet/setup_ros_sources.Dockerfile.em', 34 | os_name=os_name, 35 | os_code_name=os_code_name, 36 | ros_distro='rolling', 37 | testing_repo=True, 38 | ))@ 39 | 40 | @(TEMPLATE( 41 | 'snippet/install_ros_bootstrap_tools.Dockerfile.em', 42 | ros_distro='rolling', 43 | ))@ 44 | 45 | # setup environment 46 | ENV ROS_DISTRO=@ros2distro_name 47 | @[if 'env_before' in locals()]@ 48 | @[ for env_var, env_val in env_before.items()]@ 49 | ENV @(env_var)=@(env_val) 50 | @[ end for]@ 51 | 52 | @[end if]@ 53 | @[if 'ros2_repo_packages' in locals()]@ 54 | @[ if ros2_repo_packages]@ 55 | # install packages from the ROS repositories 56 | RUN apt-get update && apt-get install -y --no-install-recommends \ 57 | @(' \\\n '.join(sorted(ros2_repo_packages)))@ \ 58 | && rm -rf /var/lib/apt/lists/* 59 | 60 | @[ end if]@ 61 | @[end if]@ 62 | @ 63 | @[if 'pip3_install' in locals()]@ 64 | @[ if pip3_install]@ 65 | # install python packages 66 | RUN pip3 install -U \ 67 | @(' \\\n '.join(pip3_install))@ 68 | 69 | @[ end if]@ 70 | @[end if]@ 71 | # bootstrap rosdep 72 | @[if 'rosdep' in locals()]@ 73 | @[ if 'rosdistro_index_url' in rosdep]@ 74 | ENV ROSDISTRO_INDEX_URL=@(rosdep['rosdistro_index_url']) 75 | @[ end if]@ 76 | @[end if]@ 77 | RUN rosdep init \ 78 | && rosdep update --rosdistro $ROS_DISTRO 79 | 80 | @(TEMPLATE( 81 | 'snippet/setup_colcon_mixin_metadata.Dockerfile.em', 82 | ))@ 83 | 84 | @[if 'entrypoint_name' in locals()]@ 85 | @[ if entrypoint_name]@ 86 | @{ 87 | entrypoint_file = entrypoint_name.split('/')[-1] 88 | }@ 89 | # setup entrypoint 90 | COPY ./@entrypoint_file / 91 | ENTRYPOINT ["/@entrypoint_file"] 92 | @[ end if]@ 93 | @[end if]@ 94 | @{ 95 | cmds = [ 96 | 'bash', 97 | ] 98 | }@ 99 | CMD ["@(' && '.join(cmds))"] 100 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_images_ros2/testing/ros_entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # setup ros2 environment 5 | source "/opt/ros/$ROS_DISTRO/setup.bash" -- 6 | exec "$@" 7 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_library/gazebo.em: -------------------------------------------------------------------------------- 1 | Maintainers: @(',\n '.join(maintainers)) 2 | GitRepo: @(repo_url) 3 | @[for release_name, release_data in release_names.items()]@ 4 | 5 | ################################################################################ 6 | # Release: @(release_name) 7 | 8 | @[ for os_name, os_data in release_data['os_names'].items()]@ 9 | @[ for os_code_name, os_code_data in os_data['os_code_names'].items()]@ 10 | @[ if os_code_data['tag_names'] is not None]@ 11 | ######################################## 12 | # Distro: @(os_name):@(os_code_name) 13 | 14 | @[ for tag_name, tag_data in os_code_data['tag_names'].items()]@ 15 | Tags: @(', '.join(tag_data['Tags'])) 16 | Architectures: @(', '.join(tag_data['Architectures'])) 17 | GitCommit: @(tag_data['GitCommit']) 18 | Directory: @(tag_data['Directory']) 19 | 20 | @[ end for]@ 21 | @[ end if]@ 22 | @[ end for]@ 23 | @[ end for]@ 24 | @[end for]@ 25 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_library/ros.em: -------------------------------------------------------------------------------- 1 | Maintainers: @(',\n '.join(maintainers)) 2 | GitRepo: @(repo_url) 3 | @[for release_name, release_data in release_names.items()]@ 4 | 5 | ################################################################################ 6 | # Release: @(release_name) 7 | 8 | @[ for os_name, os_data in release_data['os_names'].items()]@ 9 | @[ for os_code_name, os_code_data in os_data['os_code_names'].items()]@ 10 | @[ if os_code_data['tag_names'] is not None]@ 11 | ######################################## 12 | # Distro: @(os_name):@(os_code_name) 13 | 14 | @[ for tag_name, tag_data in os_code_data['tag_names'].items()]@ 15 | Tags: @(', '.join(tag_data['Tags'])) 16 | Architectures: @(', '.join(tag_data['Architectures'])) 17 | GitCommit: @(tag_data['GitCommit']) 18 | Directory: @(tag_data['Directory']) 19 | 20 | @[ end for]@ 21 | @[ end if]@ 22 | @[ end for]@ 23 | @[ end for]@ 24 | @[end for]@ 25 | -------------------------------------------------------------------------------- /docker_templates/templates/docker_library/ros2.em: -------------------------------------------------------------------------------- 1 | Maintainers: @(',\n '.join(maintainers)) 2 | GitRepo: @(repo_url) 3 | @[for release_name, release_data in release_names.items()]@ 4 | 5 | ################################################################################ 6 | # Release: @(release_name) 7 | 8 | @[ for os_name, os_data in release_data['os_names'].items()]@ 9 | @[ for os_code_name, os_code_data in os_data['os_code_names'].items()]@ 10 | @[ if os_code_data['tag_names'] is not None]@ 11 | ######################################## 12 | # Distro: @(os_name):@(os_code_name) 13 | 14 | @[ for tag_name, tag_data in os_code_data['tag_names'].items()]@ 15 | Tags: @(', '.join(tag_data['Tags'])) 16 | Architectures: @(', '.join(tag_data['Architectures'])) 17 | GitCommit: @(tag_data['GitCommit']) 18 | Directory: @(tag_data['Directory']) 19 | 20 | @[ end for]@ 21 | @[ end if]@ 22 | @[ end for]@ 23 | @[ end for]@ 24 | @[end for]@ 25 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/add_generated_comment.Dockerfile.em: -------------------------------------------------------------------------------- 1 | # This is an auto generated Dockerfile for @(user_name):@(tag_name) 2 | # generated from @source_template_name 3 | @[if 'now_str' in locals()]@ 4 | # generated on @now_str 5 | @[end if]@ 6 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/check_pytest_regression.Dockerfile.em: -------------------------------------------------------------------------------- 1 | # This is a workaround for pytest not found causing builds to fail 2 | # Following RUN statements tests for regression of https://github.com/ros2/ros2/issues/722 3 | RUN pip3 freeze | grep pytest \ 4 | && python3 -m pytest --version 5 | 6 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/install_ros_bootstrap_tools.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @{ 2 | import rosdistro 3 | index = rosdistro.get_index(rosdistro.get_index_url()) 4 | dist_info = index.distributions[ros_distro] 5 | # distribution_type is 'ros1' or 'ros2' we retrieve the ROS version number (1 or 2) as an int: https://www.ros.org/reps/rep-0153.html#index-file 6 | ros_version = int(dist_info['distribution_type'][-1]) 7 | ros_python_version = dist_info['python_version'] 8 | prefix = 'python' 9 | if ros_python_version == 3: 10 | prefix += str(ros_python_version) 11 | package_list = [ 12 | 'build-essential', 13 | f'{prefix}-rosdep', 14 | ] 15 | if ros_version == 2: 16 | package_list += [ 17 | 'git', 18 | f'{prefix}-colcon-common-extensions', 19 | f'{prefix}-colcon-mixin', 20 | f'{prefix}-vcstool', 21 | ] 22 | else: 23 | package_list += [ 24 | f'{prefix}-rosinstall', 25 | f'{prefix}-vcstools', 26 | ] 27 | }@ 28 | # install bootstrap tools 29 | RUN apt-get update && apt-get install --no-install-recommends -y \ 30 | @(' \\\n '.join(sorted(package_list)))@ \ 31 | && rm -rf /var/lib/apt/lists/* 32 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/install_rosdep_dependencies.Dockerfile.em: -------------------------------------------------------------------------------- 1 | # install dependencies 2 | RUN apt-get update && rosdep install -y \ 3 | @(' \\\n '.join(sorted(install_args)))@ \ 4 | && rm -rf /var/lib/apt/lists/* 5 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/install_upstream_package_list.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @{ 2 | if isinstance(packages, list): 3 | if isinstance(upstream_packages, list): 4 | for pkg in upstream_packages: 5 | if pkg not in packages: 6 | packages.append(pkg) 7 | }@ 8 | @[if isinstance(packages, list)]@ 9 | @[ if packages != []]@ 10 | 11 | # install packages 12 | RUN apt-get update && apt-get install -q -y --no-install-recommends \ 13 | @(' \\\n '.join(sorted(packages)))@ \ 14 | && rm -rf /var/lib/apt/lists/* 15 | @[ end if]@ 16 | @[end if]@ 17 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/label_and_install_package_list.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @[if packages]@ 2 | @# # label @group packages 3 | @# LABEL @(' \\\n '.join('org.osrfoundation.{name}.sha256={sha256}'.format(**p) for p in packages))@ 4 | @# 5 | @# 6 | # install @group packages 7 | RUN apt-get update && apt-get install -y --no-install-recommends \ 8 | @(' \\\n '.join('{name}{version}'.format(**p) for p in packages))@ \ 9 | && rm -rf /var/lib/apt/lists/* 10 | @[end if] 11 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/setup_colcon_mixin_metadata.Dockerfile.em: -------------------------------------------------------------------------------- 1 | # setup colcon mixin and metadata 2 | RUN colcon mixin add default \ 3 | https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml && \ 4 | colcon mixin update && \ 5 | colcon metadata add default \ 6 | https://raw.githubusercontent.com/colcon/colcon-metadata-repository/master/index.yaml && \ 7 | colcon metadata update 8 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/setup_ros_sources.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @{ 2 | import distro 3 | import hashlib 4 | import os 5 | import requests 6 | 7 | import rosdistro 8 | index = rosdistro.get_index(rosdistro.get_index_url()) 9 | dist_info = index.distributions[ros_distro] 10 | ros_version = int(dist_info['distribution_type'][-1]) 11 | 12 | from docker_templates.eol_distro import isDistroEOL 13 | 14 | is_distro_eol = isDistroEOL(ros_distro_status=dist_info['distribution_status'], os_distro_name=os_code_name) 15 | if is_distro_eol: 16 | repo_url = os.path.join( 17 | 'http://snapshots.ros.org', 18 | str(ros_distro), 19 | 'final', 20 | str(os_name) 21 | ) 22 | repo_key = '4B63CF8FDE49746E98FA01DDAD19BAB3CBF125EA' 23 | source_suffix = 'snapshots' 24 | else: 25 | repo_key = 'C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654' 26 | apt_suffix = '2' if ros_version == 2 else '' 27 | source_suffix = 'latest' 28 | if 'testing_repo' in locals(): 29 | if testing_repo: 30 | apt_suffix += '-testing' 31 | source_suffix = 'testing' 32 | repo_url = f'http://packages.ros.org/ros{apt_suffix}/ubuntu' 33 | 34 | # Get the latest tag 35 | ros_apt_source_latest = requests.get('https://api.github.com/repos/ros-infrastructure/ros-apt-source/releases/latest') 36 | tag_name = ros_apt_source_latest.json().get('tag_name') 37 | 38 | # Get the latest version and compute the checksum 39 | fetch_url = f"https://github.com/ros-infrastructure/ros-apt-source/releases/download/{tag_name}/ros{apt_suffix}-apt-source_{tag_name}.{os_code_name}_all.deb" 40 | try: 41 | ros_apt_source_deb = requests.get(fetch_url) 42 | hashobj = hashlib.sha256(ros_apt_source_deb.content) 43 | file_256checksum = hashobj.hexdigest() 44 | except Exception as e: 45 | file_256checksum = f"ERROR Failed to compute checksum for {fetch_url} do not accept image. Exception: {e}" 46 | 47 | # Temp filename for simplicity of embedding 48 | temp_filename = f"/tmp/ros{apt_suffix}-apt-source.deb" 49 | }@ 50 | 51 | @[if is_distro_eol]@ 52 | # setup keys 53 | RUN set -eux; \ 54 | key='@(repo_key)'; \ 55 | export GNUPGHOME="$(mktemp -d)"; \ 56 | gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key"; \ 57 | mkdir -p /usr/share/keyrings; \ 58 | gpg --batch --export "$key" > /usr/share/keyrings/ros@(ros_version)-@(source_suffix)-archive-keyring.gpg; \ 59 | gpgconf --kill all; \ 60 | rm -rf "$GNUPGHOME" 61 | 62 | # setup sources.list 63 | RUN echo "deb [ signed-by=/usr/share/keyrings/ros@(ros_version)-@(source_suffix)-archive-keyring.gpg ] @(repo_url) @(os_code_name) main" > /etc/apt/sources.list.d/ros@(ros_version)-@(source_suffix).list 64 | @[else]@ 65 | # Setup ROS Apt sources 66 | RUN curl -L -s -o @(temp_filename) @(fetch_url) \ 67 | && echo "@(file_256checksum) @(temp_filename)" | sha256sum --strict --check \ 68 | && apt-get update \ 69 | && apt-get install @(temp_filename) \ 70 | && rm -f @(temp_filename) \ 71 | && rm -rf /var/lib/apt/lists/* 72 | @[end if]@ 73 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/setup_tzdata.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @{ 2 | releases_with_configured_tzdata = [ 3 | 'artful', 4 | 'lucid', 5 | 'maverick', 6 | 'nutty', 7 | 'oneiric', 8 | 'precise', 9 | 'quantal', 10 | 'raring', 11 | 'saucy', 12 | 'trusty', 13 | 'utopic', 14 | 'vivid', 15 | 'wily', 16 | 'xenial', 17 | 'yakkety', 18 | 'zesty', 19 | ] 20 | }@ 21 | @[if os_name == 'ubuntu' and os_code_name not in releases_with_configured_tzdata]@ 22 | 23 | # setup timezone 24 | RUN echo 'Etc/UTC' > /etc/timezone && \ 25 | ln -s /usr/share/zoneinfo/Etc/UTC /etc/localtime && \ 26 | apt-get update && \ 27 | apt-get install -q -y --no-install-recommends tzdata && \ 28 | rm -rf /var/lib/apt/lists/* 29 | @[end if]@ 30 | -------------------------------------------------------------------------------- /docker_templates/templates/snippet/vcs_import.Dockerfile.em: -------------------------------------------------------------------------------- 1 | @[if 'vcs' in locals()]@ 2 | @[ if vcs]@ 3 | @[ for i, (imports_name, imports) in enumerate(vcs.items())]@ 4 | @{ 5 | if imports['repos'] is None: 6 | imports['repos'] = "https://raw.githubusercontent.com/ros2/ros2/$ROS_DISTRO-release/ros2.repos" 7 | }@ 8 | RUN wget @(imports['repos']) \ 9 | && vcs import @(ws) < @(imports['repos'].split('/')[-1]) 10 | @[ end for]@ 11 | @[ end if]@ 12 | @[end if]@ 13 | -------------------------------------------------------------------------------- /setup.bash: -------------------------------------------------------------------------------- 1 | export PATH=`pwd`/scripts:$PATH 2 | export PYTHONPATH=`pwd`:$PYTHONPATH 3 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from setuptools import find_packages 4 | from setuptools import setup 5 | 6 | # get version number from module 7 | version_file = os.path.join( 8 | os.path.dirname(__file__), 'docker_templates', '_version.py') 9 | exec(open(version_file).read()) 10 | 11 | # Get a list of scripts to install 12 | scripts = [] 13 | for root, dirnames, filenames in os.walk('scripts'): 14 | # don't install the wrapper scripts 15 | # since they would overlay Python packages with the same name 16 | if 'wrapper' in dirnames: 17 | dirnames.remove('wrapper') 18 | for filename in filenames: 19 | if not filename.endswith('.py'): 20 | continue 21 | scripts.append(os.path.join(root, filename)) 22 | 23 | # Get the long description out of the readme.md 24 | with open(os.path.join(os.path.dirname(__file__), 'README.md'), 'r') as f: 25 | long_description = f.read() 26 | 27 | install_requires = [ 28 | 'empy', 29 | 'pyyaml', 30 | 'requests', 31 | 'rosdistro', 32 | 'ros_buildfarm', 33 | ] 34 | 35 | kwargs = { 36 | 'name': 'docker_templates', 37 | 'version': __version__, 38 | 'packages': find_packages(exclude=['test']), 39 | 'scripts': scripts, 40 | 'include_package_data': True, 41 | 'zip_safe': False, 42 | 'package_dir': {'docker_templates': 'docker_templates'}, 43 | 'package_data': {'docker_templates': ['templates/docker_images/*.em']}, 44 | 'install_requires': install_requires, 45 | 'author': 'Tully Foote', 46 | 'author_email': 'tfoote@osrfoundation.org', 47 | 'maintainer': 'Tully Foote', 48 | 'maintainer_email': 'tfoote@osrfoundation.org', 49 | 'url': 'https://github.com/osrf/docker_templates', 50 | 'keywords': ['ROS', 'Gazebo', 'docker'], 51 | 'classifiers': [ 52 | 'Programming Language :: Python', 53 | 'License :: OSI Approved :: Apache Software License'], 54 | 'description': "A package to generate Docker Base Images.", 55 | 'long_description': long_description, 56 | 'license': 'Apache 2.0', 57 | } 58 | 59 | 60 | if 'SKIP_PYTHON_MODULES' in os.environ: 61 | kwargs['packages'] = [] 62 | elif 'SKIP_PYTHON_SCRIPTS' in os.environ: 63 | kwargs['name'] += '_modules' 64 | kwargs['scripts'] = [] 65 | # else: 66 | # kwargs['install_requires'] += ['catkin_pkg >= 0.2.6', 'rosdistro >= 0.4.0'] 67 | 68 | setup(**kwargs) 69 | -------------------------------------------------------------------------------- /stdeb.cfg: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | Depends: python-argparse, python-collections, python-empy, python-yaml 3 | Depends3: python3-argparse, python3-collections, python3-empy, python3-requests, python3-yaml 4 | Suite: trusty utopic vivid wily xenial yakkety zesty artful 5 | Setup-Env-Vars: SKIP_PYTHON_MODULES=1 6 | --------------------------------------------------------------------------------