Skip to content

Commit

Permalink
Merge pull request #3 from for-geeks/release-test
Browse files Browse the repository at this point in the history
Docker: release mode no need to compile
  • Loading branch information
mickeyouyou authored Apr 26, 2020
2 parents 71c3604 + 0bbd177 commit 722e7dc
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 239 deletions.
66 changes: 66 additions & 0 deletions docker/build/build_geek_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env bash

###############################################################################
# Copyright 2019 The Apollo Authors. 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.
###############################################################################

# Usage:
# ./build_geek.sh ./cyber.x86_64.dockerfile [build|download]
# Or
# ./build_geek.sh ./cyber.aarch64.dockerfile [build|download]
DOCKERFILE=$1
INSTALL="download"
if [ -n "$2" ]; then
INSTALL="$2"
fi

if [[ $INSTALL == "build" ]]; then
echo "build all dependencies from source code"
elif [[ $INSTALL == "download" ]]; then
echo "optimize installation of some dependencies from prebuilt package"
else
echo "$INSTALL mode not supported"
exit
fi

CONTEXT="$(dirname "${BASH_SOURCE[0]}")"

REPO=geekstyle/geek_lite
ARCH=$(uname -m)
TIME=$(date +%Y%m%d_%H%M)

TAG="${REPO}:geek-release-${ARCH}-18.04-${TIME}"

# Fail on first error.
set -e
if [[ $DOCKERFILE == *$ARCH* ]]; then
echo "docker file gets matched"
docker build -t ${TAG} --build-arg INSTALL_MODE="$INSTALL" -f ${DOCKERFILE} ${CONTEXT}
else
echo "docker file '$DOCKERFILE' doesn't match"
exit
fi

echo "Built new image ${TAG}"


# Please provide credential if you want to login automatically.
DOCKER_USER=""
DOCKER_PASSWORD=""
if [ ! -z "${DOCKER_PASSWORD}" ]; then
docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ${DOCKER_REGISTRY}
fi

docker push ${TAG}
9 changes: 9 additions & 0 deletions docker/build/cyber.x86_64_release.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM geekstyle/geek_lite:geek_lite-x86_64-18.04-20200425_1848

LABEL version="1.0"

ENV DEBIAN_FRONTEND=noninteractive

RUN adduser --disabled-password --gecos '' geek

WORKDIR /geek-car
27 changes: 27 additions & 0 deletions docker/scripts/commit_push_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

# Usage:
# ./build_geek_release.sh geek.Dockerfile
# Commit
# docker commit 5a69f1c7051c geekstyle/geek_lite:geek-release-${ARCH}-18.04-${TIME}

REPO=geekstyle/geek_lite
ARCH=$(uname -m)
TIME=$(date +%Y%m%d_%H%M)

TAG="${REPO}:geek-release-${ARCH}-18.04-${TIME}"

CONTAINER_ID=$(docker ps | grep geek_release_${USER}| awk '{print $1}')

docker commit "$CONTAINER_ID" "$TAG"
# docker tag "$TAG" "$RELEASE_NAME"
docker stop "$CONTAINER_ID"

# Please provide credential if you want to login automatically.
DOCKER_USER=""
DOCKER_PASSWORD=""
if [ ! -z "${DOCKER_PASSWORD}" ]; then
docker login -u ${DOCKER_USER} -p ${DOCKER_PASSWORD} ${DOCKER_REGISTRY}
fi

docker push ${TAG}
24 changes: 0 additions & 24 deletions docker/scripts/dev_into.sh

This file was deleted.

16 changes: 0 additions & 16 deletions docker/scripts/into_geek.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,5 @@
#!/usr/bin/env bash

###############################################################################
# Copyright 2017 The Apollo Authors. 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.
###############################################################################

xhost +local:root 1>/dev/null 2>&1
docker exec \
-u $USER \
Expand Down
8 changes: 8 additions & 0 deletions docker/scripts/into_geek_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

xhost +local:root 1>/dev/null 2>&1
docker exec \
-u geek \
-it geek_release_$USER \
/bin/bash
xhost -local:root 1>/dev/null 2>&1
35 changes: 0 additions & 35 deletions docker/scripts/restart_map_volume.sh

This file was deleted.

22 changes: 1 addition & 21 deletions docker/scripts/start_geek.sh
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
#!/usr/bin/env bash

###############################################################################
# Copyright 2017 The Apollo Authors. 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.
###############################################################################

LOCAL_IMAGE="no"
FAST_BUILD_MODE="no"
FAST_TEST_MODE="no"
VERSION=""
ARCH=$(uname -m)
VERSION_X86_64="geek_lite-x86_64-18.04-20200425_1848"
VERSION_AARCH64="dev-aarch64-20170927_1111"
VERSION_OPT=""

function show_usage()
{
cat <<EOF
Usage: $(basename $0) [options] ...
OPTIONS:
-C Pull docker image from China mirror.
-b, --fast-build Light mode for building without pulling all the map volumes
-f, --fast-test Light mode for testing without pulling limited set of map volumes
-h, --help Display this help and exit.
Expand All @@ -47,7 +29,7 @@ running_containers=$(docker ps --format "{{.Names}}")

for i in ${running_containers[*]}
do
if [[ "$i" =~ apollo_* ]];then
if [[ "$i" =~ geek_* ]];then
printf %-*s 70 "stopping container: $i ..."
docker stop $i > /dev/null
if [ $? -eq 0 ];then
Expand Down Expand Up @@ -130,8 +112,6 @@ if [ ! -z "$VERSION_OPT" ]; then
VERSION=$VERSION_OPT
elif [ ${ARCH} == "x86_64" ]; then
VERSION=${VERSION_X86_64}
elif [ ${ARCH} == "aarch64" ]; then
VERSION=${VERSION_AARCH64}
else
echo "Unknown architecture: ${ARCH}"
exit 0
Expand Down
Loading

0 comments on commit 722e7dc

Please sign in to comment.