-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some improvements - to be discussed
- Loading branch information
Showing
5 changed files
with
89 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
#start from image passed by argument during build process. Usually it is an ubuntu image plus mesa library. | ||
ARG START_IMG="none" | ||
|
||
FROM $START_IMG | ||
FROM $START_IMG AS builder | ||
|
||
LABEL maintainer="[email protected], [email protected]" | ||
|
||
|
@@ -83,8 +83,20 @@ RUN echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-sel | |
cmake --build . -- ${CMAKE_EXTRA_OPTIONS} | ||
|
||
|
||
RUN echo "source ${INSTALL_DIR}/share/robotology-superbuild/setup.sh" >> $ROBOTOLOGY_INITIALIZATION_FILE | ||
RUN echo "source ${METADATA_FILE}" >> $ROBOTOLOGY_INITIALIZATION_FILE | ||
RUN echo "source ${INSTALL_DIR}/share/robotology-superbuild/setup.sh" >> $ROBOTOLOGY_INITIALIZATION_FILE &&\ | ||
echo "source ${METADATA_FILE}" >> $ROBOTOLOGY_INITIALIZATION_FILE | ||
|
||
# Stage 2: secondstage stage | ||
FROM $START_IMG AS secondstage | ||
|
||
ARG METADATA_FILE | ||
ARG PROJECTS_DIR | ||
ARG release | ||
ARG sbtag | ||
ARG metadata | ||
ARG INSTALL_DIR="/usr/local" | ||
|
||
COPY --from=builder / / | ||
|
||
# # The bashrc is read only when opening an interactive shell. Let other projects find packages contained | ||
# # in the superbuild. | ||
|
@@ -100,13 +112,11 @@ ENV QT_X11_NO_MITSHM 1 | |
ENV YARP_COLORED_OUTPUT 1 | ||
|
||
|
||
|
||
ARG metadata="none" | ||
|
||
ENV img_metadata=${metadata} | ||
RUN echo "File metadata = ${METADATA_FILE}" | ||
RUN echo 'export img_metadata=${metadata}' >> $METADATA_FILE | ||
RUN echo 'echo 'This images has release=$release and had been building with superbuild_tag=$sbtag. Metadata=$metadata ' ' >> $METADATA_FILE | ||
|
||
RUN echo "File metadata = ${METADATA_FILE}" &&\ | ||
echo 'export img_metadata=${metadata}' >> $METADATA_FILE &&\ | ||
echo 'echo 'This images has release=$release and had been building with superbuild_tag=$sbtag. Metadata=$metadata ' ' >> $METADATA_FILE | ||
|
||
|
||
CMD ["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,23 +1,14 @@ | ||
#start from image passed by argument during build process. Usually it is an ubuntu image plus mesa library. | ||
ARG START_IMG="none" | ||
ARG METADATA_FILE=/usr/local/bin/setup_metadata.sh | ||
FROM $START_IMG | ||
|
||
FROM $START_IMG AS builder | ||
|
||
LABEL maintainer="[email protected], [email protected]" | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install dependencies given in documentation in superbuild | ||
# https://github.com/robotology/robotology-superbuild#linux | ||
RUN mkdir /etc/bash_completion.d/ &&\ | ||
apt-get update &&\ | ||
apt-get install -y \ | ||
# MISC | ||
bash-completion \ | ||
git | ||
|
||
|
||
#Some definitions | ||
ARG METADATA_FILE=/usr/local/bin/setup_metadata.sh | ||
ARG PROJECTS_DIR=/projects | ||
ARG CMAKE_GENERATOR="Unix Makefiles" | ||
ARG BUILD_TYPE=Release | ||
|
@@ -27,8 +18,21 @@ ARG release | |
ARG sbtag | ||
ARG metadata | ||
ARG METADATA_FILE | ||
ARG ROBOTOLOGY_INITIALIZATION_FILE=/usr/local/bin/setup_robotology_tdd.sh | ||
|
||
# Install dependencies given in documentation in superbuild | ||
# https://github.com/robotology/robotology-superbuild#linux | ||
RUN mkdir /etc/bash_completion.d/ &&\ | ||
apt-get update &&\ | ||
apt-get install -y \ | ||
# MISC | ||
bash-completion \ | ||
git | ||
|
||
|
||
# Setup entrypoint | ||
ARG ROBOTOLOGY_INITIALIZATION_FILE=/usr/local/bin/setup_robotology_tdd.sh | ||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
COPY setup.sh ${ROBOTOLOGY_INITIALIZATION_FILE} | ||
|
||
RUN mkdir ${PROJECTS_DIR} && cd ${PROJECTS_DIR} &&\ | ||
git clone https://github.com/robotology/robotology-superbuild.git &&\ | ||
|
@@ -53,15 +57,28 @@ RUN mkdir ${PROJECTS_DIR} && cd ${PROJECTS_DIR} &&\ | |
cmake --build . --target update-all -- -j4 &&\ | ||
cmake --build . -- ${CMAKE_EXTRA_OPTIONS} | ||
|
||
# Executing commands in chain makes compilation faster | ||
# other then calling the command RUN everytime | ||
RUN echo "source ${INSTALL_DIR}/share/robotology-superbuild/setup.sh" >> $ROBOTOLOGY_INITIALIZATION_FILE &&\ | ||
echo "source ${METADATA_FILE}" >> $ROBOTOLOGY_INITIALIZATION_FILE | ||
|
||
# Stage 2: secondstage stage | ||
FROM $START_IMG AS secondstage | ||
|
||
RUN echo "source ${INSTALL_DIR}/share/robotology-superbuild/setup.sh" >> $ROBOTOLOGY_INITIALIZATION_FILE | ||
RUN echo "source ${METADATA_FILE}" >> $ROBOTOLOGY_INITIALIZATION_FILE | ||
ARG PROJECTS_DIR | ||
ARG INSTALL_DIR="/usr/local" | ||
|
||
COPY --from=builder ${PROJECTS_DIR} ${PROJECTS_DIR} | ||
COPY --from=builder /usr /usr | ||
COPY --from=builder /etc /etc | ||
|
||
# The bashrc is read only when opening an interactive shell. Let other projects find packages contained | ||
# in the superbuild. | ||
ENV CMAKE_PREFIX_PATH=${INSTALL_DIR} | ||
|
||
# This should theoretically help reducing the size of the final image | ||
FROM scratch | ||
COPY --from=secondstage / / | ||
|
||
#The EXPOSE instruction does not actually publish the port. | ||
#It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published. | ||
|
@@ -72,15 +89,16 @@ EXPOSE 10000/tcp 10000/udp | |
ENV QT_X11_NO_MITSHM 1 | ||
ENV YARP_COLORED_OUTPUT 1 | ||
|
||
ARG metadata="none" | ||
ARG METADATA_FILE | ||
ARG release | ||
ARG sbtag | ||
ARG metadata | ||
|
||
ENV img_metadata=${metadata} | ||
|
||
RUN echo 'export img_metadata=${metadata}' > $METADATA_FILE | ||
RUN echo 'echo 'This images has release=$release and had been building with superbuild_tag=$sbtag. Metadata=$metadata ' ' >> $METADATA_FILE | ||
RUN echo 'export img_metadata=${metadata}' > $METADATA_FILE &&\ | ||
echo 'echo 'This images has release=$release and had been building with superbuild_tag=$sbtag. Metadata=$metadata ' ' >> $METADATA_FILE | ||
|
||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
COPY setup.sh ${ROBOTOLOGY_INITIALIZATION_FILE} | ||
ENTRYPOINT [ "/usr/local/bin/entrypoint.sh" ] | ||
|
||
CMD ["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,12 +1,13 @@ | ||
#here add all stuff necessary to run icub-tests | ||
#start from image passed by argument during build process. Usually it is icubteamcode/superbuild:master-unstable_source | ||
ARG SOURCE_IMG="none" | ||
ARG METADATA_FILE="/usr/local/bin/setup_metadata.sh" | ||
|
||
# Stage 1: build stage | ||
FROM $SOURCE_IMG as builder | ||
|
||
LABEL maintainer="[email protected], [email protected]" | ||
|
||
ARG METADATA_FILE="/usr/local/bin/setup_metadata.sh" | ||
ARG INSTALL_DIR="/usr/local" | ||
ARG PROJECTS_DIR=/projects | ||
ARG CMAKE_GENERATOR="Unix Makefiles" | ||
|
@@ -53,6 +54,11 @@ RUN cd ${PROJECTS_DIR}/robotology-superbuild &&\ | |
cmake --build . --target update-all -- -j4 &&\ | ||
cmake --build . -- ${CMAKE_EXTRA_OPTIONS} | ||
|
||
# Stage 2: scratch stage | ||
# This should theoretically help reducing the size of the final image | ||
FROM scratch | ||
COPY --from=secondstage / / | ||
|
||
ARG metadata="none" | ||
|
||
ENV img_metadata=${metadata} | ||
|
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,11 +1,12 @@ | ||
#start from image passed by argument during build process. Usually it is an ubuntu image plus mesa library. | ||
ARG START_IMG="none" | ||
ARG METADATA_FILE="/usr/local/bin/setup_metadata.sh" | ||
|
||
FROM $START_IMG as builder | ||
# Stage 1: builder stage | ||
FROM $START_IMG AS builder | ||
|
||
LABEL maintainer="[email protected], [email protected]" | ||
|
||
ARG METADATA_FILE="/usr/local/bin/setup_metadata.sh" | ||
ARG INSTALL_DIR="/usr/local" | ||
ARG PROJECTS_DIR=/projects | ||
ARG CMAKE_GENERATOR="Unix Makefiles" | ||
|
@@ -31,6 +32,7 @@ RUN mkdir -p /etc/bash_completion.d/ && \ | |
vim &&\ | ||
update-ca-certificates | ||
|
||
# Print debug info to check if relevant build args are taken correctly from conf_build.ini | ||
RUN echo "DEBUG ==> Release:" ${release} &&\ | ||
echo "DEBUG ==> TAG: " ${tag} &&\ | ||
echo "DEBUG ==> metadata: " ${metadata} | ||
|
@@ -62,12 +64,25 @@ RUN mkdir ${PROJECTS_DIR} && cd ${PROJECTS_DIR} &&\ | |
# Build all the projects | ||
cmake --build . -- ${CMAKE_EXTRA_OPTIONS} -j5 | ||
|
||
# This steps should theoretically help cleaning unecessary post-build files that are already installed and that can be eventually re-generated | ||
RUN rm -rf ${PROJECTS_DIR}/robotology-superbuild/build/src &&\ | ||
echo "source ${INSTALL_DIR}/share/robotology-superbuild/setup.sh" >> $ROBOTOLOGY_INITIALIZATION_FILE | ||
|
||
|
||
# NEW STAGE ###### | ||
FROM $START_IMG as secondstage | ||
# Do we still need this repo from appsAway?? | ||
# RUN cd ${PROJECTS_DIR} && \ | ||
# git clone https://github.com/icub-tech-iit/appsAway.git && \ | ||
# cd appsAway/modules/checkRobotInterface && \ | ||
# mkdir build && cd build && \ | ||
# cmake .. \ | ||
# -G "$CMAKE_GENERATOR" \ | ||
# -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ | ||
# &&\ | ||
# cmake --build . -- ${CMAKE_EXTRA_OPTIONS} && \ | ||
# cp ./checkRobotInterface /usr/local/bin | ||
|
||
# Stage 2: secondstage stage | ||
FROM $START_IMG AS secondstage | ||
|
||
# Setup entrypoint | ||
ARG ROBOTOLOGY_INITIALIZATION_FILE=/usr/local/bin/setup_robotology_tdd.sh | ||
|
@@ -87,8 +102,12 @@ RUN echo 'export img_metadata=${metadata}' > ${METADATA_FILE} &&\ | |
|
||
RUN echo "source ${METADATA_FILE}" >> ${ROBOTOLOGY_INITIALIZATION_FILE} | ||
|
||
# COPY --from=secondstage / / | ||
# This should theoretically help reducing the size of the final image | ||
FROM scratch | ||
|
||
ARG metadata | ||
|
||
COPY --from=secondstage / / | ||
|
||
#The EXPOSE instruction does not actually publish the port. | ||
#It functions as a type of documentation between the person who builds the image and the person who runs the container, about which ports are intended to be published. | ||
|
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ ARG START_IMG="none" | |
ARG SOURCE_IMG="none" | ||
|
||
FROM $SOURCE_IMG AS builder | ||
FROM $START_IMG as secondstage | ||
FROM $START_IMG AS secondstage | ||
|
||
LABEL maintainer="[email protected], [email protected]" | ||
|
||
|