add dockerfile

This commit is contained in:
peng.xu 2019-09-18 18:16:51 +08:00
parent 0ad5c32c46
commit c042d2f323
2 changed files with 42 additions and 0 deletions

10
Dockerfile Normal file
View File

@ -0,0 +1,10 @@
FROM python:3.6
RUN apt update && apt install -y \
less \
telnet
RUN mkdir /source
WORKDIR /source
ADD ./requirements.txt ./
RUN pip install -r requirements.txt
COPY . .
CMD python mishards/main.py

32
build.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
BOLD=`tput bold`
NORMAL=`tput sgr0`
YELLOW='\033[1;33m'
ENDC='\033[0m'
function build_image() {
dockerfile=$1
remote_registry=$2
tagged=$2
buildcmd="docker build -t ${tagged} -f ${dockerfile} ."
echo -e "${BOLD}$buildcmd${NORMAL}"
$buildcmd
pushcmd="docker push ${remote_registry}"
echo -e "${BOLD}$pushcmd${NORMAL}"
$pushcmd
echo -e "${YELLOW}${BOLD}Image: ${remote_registry}${NORMAL}${ENDC}"
}
case "$1" in
all)
version=""
[[ ! -z $2 ]] && version=":${2}"
build_image "Dockerfile" "registry.zilliz.com/milvus/mishards${version}" "registry.zilliz.com/milvus/mishards"
;;
*)
echo "Usage: [option...] {base | apps}"
echo "all, Usage: build.sh all [tagname|] => registry.zilliz.com/milvus/mishards:\${tagname}"
;;
esac