This repository was archived by the owner on Dec 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 60
[WIP] Option to create a deployable runtime image #200
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# This dockerfile creates an image containing the runtime environment for the workspace. | ||
# For now this is a thin layer on top of the sysroot/buildroot environment used to build. | ||
# It re-sets the entrypoint to a shell instead of a build script, and copies in the install. | ||
# The eventual plan for it is to only contain `<exec_depends>` of the workspace | ||
|
||
ARG BASE_IMAGE | ||
FROM $BASE_IMAGE | ||
WORKDIR /ros_ws | ||
|
||
ARG INSTALL_PATH | ||
COPY $INSTALL_PATH/ /ros_ws/install | ||
|
||
RUN echo "source /ros_ws/install/setup.bash" >> ~/.bashrc | ||
ENTRYPOINT /bin/bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
import logging | ||
import os | ||
from pathlib import Path | ||
|
||
from ros_cross_compile.docker_client import DockerClient | ||
from ros_cross_compile.platform import Platform | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def create_runtime_image( | ||
docker_client: DockerClient, platform: Platform, workspace_dir: Path, image_tag: str | ||
): | ||
logger.info('----------------------') | ||
logger.info('Building runtime image: {}'.format(image_tag)) | ||
logger.info('----------------------') | ||
|
||
docker_client.build_image( | ||
dockerfile_name=os.path.join(docker_client._default_docker_dir, 'runtime.Dockerfile'), | ||
dockerfile_dir=workspace_dir, | ||
tag=image_tag, | ||
buildargs={ | ||
'BASE_IMAGE': platform.sysroot_image_tag, | ||
'INSTALL_PATH': 'install_{}'.format(platform.arch), | ||
}, | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docstring please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant L26. Can you add docstring to the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have a linter for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ament_flake8 disables the docstring requirement. I'll add it, good call 👍