-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from for-geeks/release-test
Docker: release mode no need to compile
- Loading branch information
Showing
9 changed files
with
129 additions
and
239 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 |
---|---|---|
@@ -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} |
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,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 |
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,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} |
This file was deleted.
Oops, something went wrong.
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,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 |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.