forked from autowarefoundation/autoware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Takagi, Isamu <[email protected]>
- Loading branch information
1 parent
d6db15a
commit 104b078
Showing
6 changed files
with
57 additions
and
155 deletions.
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
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 |
---|---|---|
@@ -1,128 +1,74 @@ | ||
# Image args should come at the beginning. | ||
# hadolint global ignore=DL3006,DL3008 | ||
ARG BASE_IMAGE | ||
ARG PREBUILT_BASE_IMAGE | ||
# hadolint ignore=DL3006 | ||
|
||
# ============================================================================== | ||
FROM $BASE_IMAGE as devel | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
ARG ROS_DISTRO | ||
ARG SETUP_ARGS | ||
|
||
## Install apt packages | ||
# hadolint ignore=DL3008 | ||
# Install apt packages | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ | ||
git \ | ||
ssh \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache | ||
|
||
# Add GitHub to known hosts for private repositories | ||
RUN mkdir -p ~/.ssh \ | ||
&& ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
|
||
## Copy files | ||
# Copy files | ||
COPY autoware.repos setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/ | ||
COPY ansible/ /autoware/ansible/ | ||
WORKDIR /autoware | ||
RUN ls /autoware | ||
|
||
## Add GitHub to known hosts for private repositories | ||
RUN mkdir -p ~/.ssh \ | ||
&& ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
|
||
## Set up development environment | ||
# Set up development environment | ||
RUN --mount=type=ssh \ | ||
./setup-dev-env.sh -y $SETUP_ARGS universe \ | ||
./setup-dev-env.sh -y --runtime $SETUP_ARGS universe \ | ||
&& pip uninstall -y ansible ansible-core \ | ||
&& mkdir src \ | ||
&& vcs import src < autoware.repos \ | ||
&& rosdep update \ | ||
&& DEBIAN_FRONTEND=noninteractive rosdep install -y --ignore-src --from-paths src --rosdistro "$ROS_DISTRO" \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
&& apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache | ||
|
||
## Clean up unnecessary files | ||
# Clean up unnecessary files | ||
RUN rm -rf \ | ||
"$HOME"/.cache \ | ||
/etc/apt/sources.list.d/cuda*.list \ | ||
/etc/apt/sources.list.d/docker.list \ | ||
/etc/apt/sources.list.d/nvidia-docker.list | ||
|
||
## Register Vulkan GPU vendors | ||
RUN curl https://gitlab.com/nvidia/container-images/vulkan/raw/dc389b0445c788901fda1d85be96fd1cb9410164/nvidia_icd.json -o /etc/vulkan/icd.d/nvidia_icd.json \ | ||
&& chmod 644 /etc/vulkan/icd.d/nvidia_icd.json | ||
RUN curl https://gitlab.com/nvidia/container-images/opengl/raw/5191cf205d3e4bb1150091f9464499b076104354/glvnd/runtime/10_nvidia.json -o /etc/glvnd/egl_vendor.d/10_nvidia.json \ | ||
&& chmod 644 /etc/glvnd/egl_vendor.d/10_nvidia.json | ||
# Register Vulkan GPU vendors | ||
ADD "https://gitlab.com/nvidia/container-images/vulkan/raw/dc389b0445c788901fda1d85be96fd1cb9410164/nvidia_icd.json" /etc/vulkan/icd.d/nvidia_icd.json | ||
RUN chmod 644 /etc/vulkan/icd.d/nvidia_icd.json | ||
ADD "https://gitlab.com/nvidia/container-images/opengl/raw/5191cf205d3e4bb1150091f9464499b076104354/glvnd/runtime/10_nvidia.json" /etc/glvnd/egl_vendor.d/10_nvidia.json | ||
RUN chmod 644 /etc/glvnd/egl_vendor.d/10_nvidia.json | ||
|
||
## Register OpenCL GPU vendors | ||
# Register OpenCL GPU vendors | ||
RUN mkdir -p /etc/OpenCL/vendors \ | ||
&& echo "libnvidia-opencl.so.1" > /etc/OpenCL/vendors/nvidia.icd \ | ||
&& chmod 644 /etc/OpenCL/vendors/nvidia.icd | ||
|
||
## Create entrypoint | ||
# hadolint ignore=DL3059 | ||
RUN echo "source /opt/ros/${ROS_DISTRO}/setup.bash" > /etc/bash.bashrc | ||
CMD ["/bin/bash"] | ||
|
||
FROM devel as builder | ||
# ============================================================================== | ||
FROM devel as prebuilt | ||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
## Build and change permission for runtime data conversion | ||
# Build and change permission for runtime data conversion | ||
RUN source /opt/ros/"$ROS_DISTRO"/setup.bash \ | ||
&& colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release \ | ||
&& find /autoware/install -type d -exec chmod 777 {} \; | ||
|
||
# hadolint ignore=DL3006 | ||
FROM $PREBUILT_BASE_IMAGE as prebuilt | ||
|
||
SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||
|
||
ARG ROS_DISTRO | ||
ARG SETUP_ARGS | ||
|
||
## Install apt packages | ||
# hadolint ignore=DL3008 | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ | ||
git \ | ||
ssh \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
## Copy files | ||
COPY autoware.repos setup-dev-env.sh ansible-galaxy-requirements.yaml amd64.env arm64.env /autoware/ | ||
COPY ansible/ /autoware/ansible/ | ||
WORKDIR /autoware | ||
RUN ls /autoware | ||
|
||
## Add GitHub to known hosts for private repositories | ||
RUN mkdir -p ~/.ssh \ | ||
&& ssh-keyscan github.com >> ~/.ssh/known_hosts | ||
|
||
## Set up runtime environment | ||
RUN --mount=type=ssh \ | ||
./setup-dev-env.sh -y $SETUP_ARGS --no-cuda-drivers --runtime universe \ | ||
&& pip uninstall -y ansible ansible-core \ | ||
&& mkdir src \ | ||
&& vcs import src < autoware.repos \ | ||
&& rosdep update \ | ||
&& DEBIAN_FRONTEND=noninteractive rosdep install -y --ignore-src --from-paths src --rosdistro "$ROS_DISTRO" \ | ||
&& rm -rf src \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
## Copy install folder from builder | ||
COPY --from=builder /autoware/install/ /autoware/install/ | ||
# Create entrypoint | ||
RUN echo "source /autoware/install/setup.bash" > /etc/bash.bashrc | ||
CMD ["/bin/bash"] | ||
|
||
## Clean up unnecessary files | ||
RUN rm -rf \ | ||
"$HOME"/.cache \ | ||
/etc/apt/sources.list.d/cuda*.list \ | ||
/etc/apt/sources.list.d/docker.list \ | ||
/etc/apt/sources.list.d/nvidia-docker.list | ||
# ============================================================================== | ||
FROM devel as runtime | ||
|
||
## Register Vulkan GPU vendors | ||
ADD "https://gitlab.com/nvidia/container-images/vulkan/raw/dc389b0445c788901fda1d85be96fd1cb9410164/nvidia_icd.json" /etc/vulkan/icd.d/nvidia_icd.json | ||
RUN chmod 644 /etc/vulkan/icd.d/nvidia_icd.json | ||
ADD "https://gitlab.com/nvidia/container-images/opengl/raw/5191cf205d3e4bb1150091f9464499b076104354/glvnd/runtime/10_nvidia.json" /etc/glvnd/egl_vendor.d/10_nvidia.json | ||
RUN chmod 644 /etc/glvnd/egl_vendor.d/10_nvidia.json | ||
# Remove setup files and copy install directory | ||
RUN rm -rf /autoware/* | ||
COPY --from=prebuilt /autoware/install/ /autoware/install/ | ||
|
||
## Create entrypoint | ||
# hadolint ignore=DL3059 | ||
# Create entrypoint | ||
RUN echo "source /autoware/install/setup.bash" > /etc/bash.bashrc | ||
CMD ["/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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
group "default" { | ||
targets = ["devel", "prebuilt"] | ||
targets = ["devel", "prebuilt", "runtime"] | ||
} | ||
|
||
// For docker/metadata-action | ||
target "docker-metadata-action-devel" {} | ||
target "docker-metadata-action-prebuilt" {} | ||
target "docker-metadata-action-runtime" {} | ||
|
||
// For source image | ||
target "devel" { | ||
inherits = ["docker-metadata-action-devel"] | ||
dockerfile = "docker/autoware-universe/Dockerfile" | ||
target = "devel" | ||
} | ||
|
||
// For prebuilt image | ||
target "prebuilt" { | ||
inherits = ["docker-metadata-action-prebuilt"] | ||
dockerfile = "docker/autoware-universe/Dockerfile" | ||
target = "prebuilt" | ||
} | ||
|
||
// For runtime image | ||
target "runtime" { | ||
inherits = ["docker-metadata-action-runtime"] | ||
dockerfile = "docker/autoware-universe/Dockerfile" | ||
target = "runtime" | ||
} |
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