提交 4ab8fc8d 编写于 作者: C changsh726 提交者: Chang Songhong

updated runtime standalone functions

上级 6ed96a14
.cache .cache
docs
docker/build docker/build
...@@ -15,6 +15,7 @@ install( ...@@ -15,6 +15,7 @@ install(
"//cyber:install", "//cyber:install",
"//cyber/examples:install", "//cyber/examples:install",
"//docker/scripts:install", "//docker/scripts:install",
"//docs/demo_guide:install",
"//modules/audio:install", "//modules/audio:install",
"//modules/bridge:install", "//modules/bridge:install",
"//modules/canbus:install", "//modules/canbus:install",
......
...@@ -10,7 +10,7 @@ export CYBER_DOMAIN_ID=80 ...@@ -10,7 +10,7 @@ export CYBER_DOMAIN_ID=80
export CYBER_IP=127.0.0.1 export CYBER_IP=127.0.0.1
export GLOG_log_dir="${APOLLO_ROOT_DIR}/data/log" export GLOG_log_dir="${APOLLO_ROOT_DIR}/data/log"
export GLOG_alsologtostderr=1 export GLOG_alsologtostderr=0
export GLOG_colorlogtostderr=1 export GLOG_colorlogtostderr=1
export GLOG_minloglevel=0 export GLOG_minloglevel=0
......
load("//tools/install:install.bzl", "install") load("//tools/install:install.bzl", "install")
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
) )
...@@ -7,7 +8,7 @@ install( ...@@ -7,7 +8,7 @@ install(
name = "install", name = "install",
deps = [ deps = [
"//cyber/tools/cyber_launch:install", "//cyber/tools/cyber_launch:install",
"//cyber/tools/cyber_monitor:install",
"//cyber/tools/cyber_recorder:install", "//cyber/tools/cyber_recorder:install",
], ],
) )
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library")
load("//tools:cpplint.bzl", "cpplint") load("//tools:cpplint.bzl", "cpplint")
load("//tools/install:install.bzl", "install")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
install(
name = "install",
targets = [
":cyber_monitor",
],
)
cc_binary( cc_binary(
name = "cyber_monitor", name = "cyber_monitor",
srcs = [ srcs = [
......
...@@ -57,7 +57,7 @@ RUN bash /opt/apollo/installers/install_mkl.sh ...@@ -57,7 +57,7 @@ RUN bash /opt/apollo/installers/install_mkl.sh
# TODO(storypku): NodeJS # TODO(storypku): NodeJS
COPY --from=devel /usr/local/fast-rtps /usr/local/fast-rtps COPY --from=devel /usr/local/fast-rtps /usr/local/fast-rtps
COPY --from=devel /usr/local/libtorch_gpu /usr/local/libtorch_gpu COPY --from=devel /usr/local/libtorch_gpu /usr/local/libtorch_gpu
COPY --from=devel /usr/local/qt5/lib /usr/local/qt5/lib COPY --from=devel /usr/local/qt5 /usr/local/qt5
COPY --from=devel /etc/ld.so.conf.d/qt.conf /etc/ld.so.conf.d/qt.conf COPY --from=devel /etc/ld.so.conf.d/qt.conf /etc/ld.so.conf.d/qt.conf
COPY --from=devel /opt/apollo/pkgs /opt/apollo/pkgs COPY --from=devel /opt/apollo/pkgs /opt/apollo/pkgs
COPY --from=devel /opt/apollo/sysroot/lib /opt/apollo/sysroot/lib COPY --from=devel /opt/apollo/sysroot/lib /opt/apollo/sysroot/lib
......
...@@ -3,54 +3,48 @@ ARG TARGET_ARCH=x86_64 ...@@ -3,54 +3,48 @@ ARG TARGET_ARCH=x86_64
ARG IMAGE_VERSION=18.04-20210517_1712 ARG IMAGE_VERSION=18.04-20210517_1712
ARG BASE_IMAGE=${DOCKER_REPO}:runtime-${TARGET_ARCH}-${IMAGE_VERSION} ARG BASE_IMAGE=${DOCKER_REPO}:runtime-${TARGET_ARCH}-${IMAGE_VERSION}
ARG DOCKER_USER
ARG DOCKER_USER_ID
ARG DOCKER_GRP
ARG DOCKER_GRP_ID
FROM ${DOCKER_REPO}:data_volume-audio_model-${TARGET_ARCH}-latest as apollo_audio_volume FROM ${DOCKER_REPO}:data_volume-audio_model-${TARGET_ARCH}-latest as apollo_audio_volume
FROM ${DOCKER_REPO}:yolov4_volume-emergency_detection_model-${TARGET_ARCH}-latest as apollo_yolov4_volume FROM ${DOCKER_REPO}:yolov4_volume-emergency_detection_model-${TARGET_ARCH}-latest as apollo_yolov4_volume
FROM ${DOCKER_REPO}:faster_rcnn_volume-traffic_light_detection_model-${TARGET_ARCH}-latest as apollo_faster_rcnn_volume FROM ${DOCKER_REPO}:faster_rcnn_volume-traffic_light_detection_model-${TARGET_ARCH}-latest as apollo_faster_rcnn_volume
FROM ${DOCKER_REPO}:smoke_volume-yolo_obstacle_detection_model-${TARGET_ARCH}-latest as apollo_smoke_volume FROM ${DOCKER_REPO}:smoke_volume-yolo_obstacle_detection_model-${TARGET_ARCH}-latest as apollo_smoke_volume
FROM ${DOCKER_REPO}:map_volume-sunnyvale_big_loop-latest as sunnyvale_big_loop_volume
FROM ${DOCKER_REPO}:map_volume-sunnyvale_loop-latest as sunnyvale_loop_volume
FROM ${DOCKER_REPO}:map_volume-sunnyvale_with_two_offices-latest as sunnyvale_with_two_offices_volume
FROM ${DOCKER_REPO}:map_volume-san_mateo-latest as san_mateo_volume
FROM ${BASE_IMAGE} FROM ${BASE_IMAGE}
ENV DOCKER_USER=${DOCKER_USER:-apollo} COPY output /apollo
ENV DOCKER_USER_ID=${DOCKER_USER_ID:-1001}
ENV DOCKER_GRP=${DOCKER_GRP:-apollo} COPY --from=apollo_audio_volume \
ENV DOCKER_GRP_ID=${DOCKER_GRP_ID:-1001}
# We need to copy output first to make sure that the top-level /apollo directory is also owned by ${DOCKER_USER_ID}:${DOCKER_GRP_ID},
# because COPY --chown creates target directory as root and only chowns the files it copies.
# If we copy some volume first then /apollo is owned by root and different user will fail to create e.g.
# nohup.out or /apollo/data there (in runtime image it's overlayed by a volume from host, so it doesn't harm)
COPY \
--chown=${DOCKER_USER_ID}:${DOCKER_GRP_ID} \
output \
/apollo
COPY \
--from=apollo_audio_volume \
--chown=${DOCKER_USER_ID}:${DOCKER_GRP_ID} \
/apollo/modules/audio \ /apollo/modules/audio \
/apollo/modules/audio /apollo/modules/audio
COPY \ COPY --from=apollo_yolov4_volume \
--from=apollo_yolov4_volume \
--chown=${DOCKER_USER_ID}:${DOCKER_GRP_ID} \
/apollo/modules/perception/camera/lib/obstacle/detector/yolov4 \ /apollo/modules/perception/camera/lib/obstacle/detector/yolov4 \
/apollo/modules/perception/camera/lib/obstacle/detector/yolov4 /apollo/modules/perception/camera/lib/obstacle/detector/yolov4
COPY \ COPY --from=apollo_faster_rcnn_volume \
--from=apollo_faster_rcnn_volume \
--chown=${DOCKER_USER_ID}:${DOCKER_GRP_ID} \
/apollo/modules/perception/production/data/perception/camera/models/traffic_light_detection \ /apollo/modules/perception/production/data/perception/camera/models/traffic_light_detection \
/apollo/modules/perception/production/data/perception/camera/models/traffic_light_detection /apollo/modules/perception/production/data/perception/camera/models/traffic_light_detection
COPY \ COPY --from=apollo_smoke_volume \
--from=apollo_smoke_volume \
--chown=${DOCKER_USER_ID}:${DOCKER_GRP_ID} \
/apollo/modules/perception/production/data/perception/camera/models/yolo_obstacle_detector \ /apollo/modules/perception/production/data/perception/camera/models/yolo_obstacle_detector \
/apollo/modules/perception/production/data/perception/camera/models/yolo_obstacle_detector /apollo/modules/perception/production/data/perception/camera/models/yolo_obstacle_detector
RUN /apollo/scripts/docker_start_user.sh COPY --from=sunnyvale_big_loop_volume \
/apollo/modules/map/data/sunnyvale_big_loop \
/apollo/modules/map/data/sunnyvale_big_loop
COPY --from=sunnyvale_loop_volume \
/apollo/modules/map/data/sunnyvale_loop \
/apollo/modules/map/data/sunnyvale_loop
COPY --from=sunnyvale_with_two_offices_volume \
/apollo/modules/map/data/sunnyvale_with_two_offices \
/apollo/modules/map/data/sunnyvale_with_two_offices
COPY --from=san_mateo_volume \
/apollo/modules/map/data/san_mateo \
/apollo/modules/map/data/san_mateo
...@@ -3,10 +3,6 @@ ...@@ -3,10 +3,6 @@
# Copyright (c) 2021 LG Electronics, Inc. All Rights Reserved # Copyright (c) 2021 LG Electronics, Inc. All Rights Reserved
DOCKER_REPO=apolloauto/apollo DOCKER_REPO=apolloauto/apollo
DOCKER_USER=apollo
DOCKER_USER_ID=1001
DOCKER_GRP=apollo
DOCKER_GRP_ID=1001
TARGET_ARCH=x86_64 TARGET_ARCH=x86_64
IMAGE_VERSION=18.04-20210517_1712 IMAGE_VERSION=18.04-20210517_1712
DEV_IMAGE=${DOCKER_REPO}:dev-${TARGET_ARCH}-${IMAGE_VERSION} DEV_IMAGE=${DOCKER_REPO}:dev-${TARGET_ARCH}-${IMAGE_VERSION}
...@@ -51,17 +47,8 @@ rm -f docker/build/syspkgs.txt ...@@ -51,17 +47,8 @@ rm -f docker/build/syspkgs.txt
mv output docker/build mv output docker/build
mkdir -p docker/build/output/standalone-scripts/docker/scripts
cp docker/scripts/{runtime_start.sh,runtime_into_standalone.sh,docker_base.sh} docker/build/output/standalone-scripts/docker/scripts
mkdir -p docker/build/output/standalone-scripts/scripts
cp scripts/{common.bashrc,apollo_base.sh,apollo.bashrc} docker/build/output/standalone-scripts/scripts
docker build \ docker build \
--build-arg BASE_IMAGE=${RUNTIME_IMAGE} \ --build-arg BASE_IMAGE=${RUNTIME_IMAGE} \
--build-arg DOCKER_USER=${DOCKER_USER} \
--build-arg DOCKER_USER_ID=${DOCKER_USER_ID} \
--build-arg DOCKER_GRP=${DOCKER_GRP} \
--build-arg DOCKER_GRP_ID=${DOCKER_GRP_ID} \
-f docker/build/standalone.x86_64.dockerfile \ -f docker/build/standalone.x86_64.dockerfile \
docker/build/ \ docker/build/ \
-t ${STANDALONE_IMAGE} -t ${STANDALONE_IMAGE}
...@@ -69,7 +56,6 @@ docker build \ ...@@ -69,7 +56,6 @@ docker build \
docker tag ${STANDALONE_IMAGE} ${STANDALONE_IMAGE_LATEST} docker tag ${STANDALONE_IMAGE} ${STANDALONE_IMAGE_LATEST}
/bin/echo -e "Docker image with prebuilt files was built and tagged as ${STANDALONE_IMAGE}, you can start it with: \n\ /bin/echo -e "Docker image with prebuilt files was built and tagged as ${STANDALONE_IMAGE}, you can start it with: \n\
cd docker/build/output/standalone-scripts bash docker/scripts/runtime_start.sh --standalone --local --tag standalone-${TARGET_ARCH}-${IMAGE_VERSION}\n\
RUNTIME_STANDALONE_USER=${DOCKER_USER} RUNTIME_STANDALONE_GROUP=${DOCKER_GRP} RUNTIME_STANDALONE_UID=${DOCKER_USER_ID} RUNTIME_STANDALONE_GID=${DOCKER_GRP_ID} docker/scripts/runtime_start.sh --standalone --local --tag standalone-${TARGET_ARCH}-${IMAGE_VERSION}\n\
and switch into it with:\n\ and switch into it with:\n\
RUNTIME_STANDALONE_USER=${DOCKER_USER} docker/scripts/runtime_into_standalone.sh" bash docker/scripts/runtime_into_standalone.sh"
...@@ -15,13 +15,11 @@ ...@@ -15,13 +15,11 @@
# limitations under the License. # limitations under the License.
############################################################################### ###############################################################################
DOCKER_USER="${USER}"
RUNTIME_CONTAINER="apollo_runtime_standalone_${USER}" RUNTIME_CONTAINER="apollo_runtime_standalone_${USER}"
[ -n "${RUNTIME_STANDALONE_USER}" ] && DOCKER_USER="${RUNTIME_STANDALONE_USER}"
xhost +local:root 1>/dev/null 2>&1 xhost +local:root 1>/dev/null 2>&1
docker exec -u "${DOCKER_USER}" \ docker exec -u "${USER}" \
-it "${RUNTIME_CONTAINER}" \ -it "${RUNTIME_CONTAINER}" \
/bin/bash /bin/bash
......
...@@ -159,7 +159,6 @@ function check_host_environment() { ...@@ -159,7 +159,6 @@ function check_host_environment() {
if [[ -f "${CURR_DIR}/dev_start.sh" ]]; then if [[ -f "${CURR_DIR}/dev_start.sh" ]]; then
warning "${CURR_DIR}/dev_start.sh detected." warning "${CURR_DIR}/dev_start.sh detected."
warning "Apollo Runtime Docker is expected to run with release builds." warning "Apollo Runtime Docker is expected to run with release builds."
exit 3
fi fi
} }
...@@ -170,7 +169,11 @@ function setup_devices_and_mount_local_volumes() { ...@@ -170,7 +169,11 @@ function setup_devices_and_mount_local_volumes() {
setup_device setup_device
local volumes="" local volumes=""
$RUNTIME_STANDALONE || volumes="-v ${APOLLO_ROOT_DIR}:/apollo" if $RUNTIME_STANDALONE; then
volumes="-v ${APOLLO_ROOT_DIR}/data:/apollo/data"
else
volumes="-v ${APOLLO_ROOT_DIR}:/apollo"
fi
local os_release="$(lsb_release -rs)" local os_release="$(lsb_release -rs)"
case "${os_release}" in case "${os_release}" in
...@@ -340,12 +343,6 @@ function main() { ...@@ -340,12 +343,6 @@ function main() {
local docker_group="$(id -g -n)" local docker_group="$(id -g -n)"
local docker_gid="$(id -g)" local docker_gid="$(id -g)"
if $RUNTIME_STANDALONE; then
[ -n "${RUNTIME_STANDALONE_USER}" ] && docker_user="${RUNTIME_STANDALONE_USER}"
[ -n "${RUNTIME_STANDALONE_UID}" ] && docker_uid="${RUNTIME_STANDALONE_UID}"
[ -n "${RUNTIME_STANDALONE_GROUP}" ] && docker_group="${RUNTIME_STANDALONE_GROUP}"
[ -n "${RUNTIME_STANDALONE_GID}" ] && docker_gid="${RUNTIME_STANDALONE_GID}"
fi
set -x set -x
${DOCKER_RUN_CMD} -itd \ ${DOCKER_RUN_CMD} -itd \
--privileged \ --privileged \
...@@ -362,7 +359,6 @@ function main() { ...@@ -362,7 +359,6 @@ function main() {
-e NVIDIA_DRIVER_CAPABILITIES=compute,video,graphics,utility \ -e NVIDIA_DRIVER_CAPABILITIES=compute,video,graphics,utility \
${MAP_VOLUMES_CONF} \ ${MAP_VOLUMES_CONF} \
${OTHER_VOLUMES_CONF} \ ${OTHER_VOLUMES_CONF} \
${LOCAL_VOLUMES_CONF} \
${local_volumes} \ ${local_volumes} \
--net host \ --net host \
-w /apollo \ -w /apollo \
...@@ -383,6 +379,8 @@ function main() { ...@@ -383,6 +379,8 @@ function main() {
postrun_start_user ${RUNTIME_CONTAINER} postrun_start_user ${RUNTIME_CONTAINER}
$RUNTIME_STANDALONE && docker exec -u root "${RUNTIME_CONTAINER}" bash -c "chown -R ${docker_uid}:${docker_gid} /apollo"
ok "Congratulations! You have successfully finished setting up Apollo Runtime Environment." ok "Congratulations! You have successfully finished setting up Apollo Runtime Environment."
ok "To login into the newly created ${RUNTIME_CONTAINER} container, please run the following command:" ok "To login into the newly created ${RUNTIME_CONTAINER} container, please run the following command:"
$RUNTIME_STANDALONE || ok " bash docker/scripts/runtime_into.sh" $RUNTIME_STANDALONE || ok " bash docker/scripts/runtime_into.sh"
......
load("//tools/install:install.bzl", "install")
package(
default_visibility = ["//visibility:public"],
)
install(
name = "install",
data = [
":record_helper",
],
)
filegroup(
name = "record_helper",
srcs = [
"record_helper.py",
],
)
load("//tools/install:install.bzl", "install") load("//tools/install:install.bzl", "install")
package( package(
default_visibility = ["//visibility:public"], default_visibility = ["//visibility:public"],
) )
...@@ -6,6 +7,7 @@ package( ...@@ -6,6 +7,7 @@ package(
install( install(
name = "install", name = "install",
deps = [ deps = [
"//modules/map/data:install",
"//modules/map/tools:install", "//modules/map/tools:install",
], ],
) )
load("//tools/install:install.bzl", "install")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
install(
name = "install",
data = [
":demo",
":borregas_ave",
],
)
filegroup( filegroup(
name = "map_sunnyvale_big_loop", name = "map_sunnyvale_big_loop",
testonly = True, testonly = True,
...@@ -15,3 +25,17 @@ filegroup( ...@@ -15,3 +25,17 @@ filegroup(
"sunnyvale_loop/**", "sunnyvale_loop/**",
]), ]),
) )
filegroup(
name = "demo",
srcs = glob([
"demo/**",
])
)
filegroup(
name = "borregas_ave",
srcs = glob([
"borregas_ave/**",
])
)
...@@ -9,5 +9,6 @@ install( ...@@ -9,5 +9,6 @@ install(
deps = [ deps = [
"//modules/tools/create_map:install", "//modules/tools/create_map:install",
"//modules/tools/map_gen:install", "//modules/tools/map_gen:install",
"//modules/tools/visualizer:install",
], ],
) )
load("@rules_cc//cc:defs.bzl", "cc_binary") load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//third_party/qt5:qt.bzl", "qt_cc_library") load("//third_party/qt5:qt.bzl", "qt_cc_library")
load("//tools/install:install.bzl", "install")
package(default_visibility = ["//visibility:public"]) package(default_visibility = ["//visibility:public"])
install(
name = "install",
targets = [
":cyber_visualizer",
],
deps = [
"//cyber:install",
],
)
cc_binary( cc_binary(
name = "cyber_visualizer", name = "cyber_visualizer",
copts = [ copts = [
......
...@@ -101,6 +101,9 @@ function generate_solibs() { ...@@ -101,6 +101,9 @@ function generate_solibs() {
-exec bash -c 'retrieve_so_deps "$0"' {} \ -exec bash -c 'retrieve_so_deps "$0"' {} \
>> ${listing} \; >> ${listing} \;
done done
find /usr/local/qt5/ -name "*.so" -exec bash -c 'retrieve_so_deps "$0"' {} \
>> ${listing} \;
cat ${listing} | sort -u cat ${listing} | sort -u
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册