update at 2021-01-21 12:07:20 by ehlxr
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ehlxr 2021-01-21 12:07:20 +08:00
parent 7ab2e65490
commit 72916693f1
2 changed files with 11 additions and 12 deletions

View File

@ -6,8 +6,7 @@ WORKDIR /opt
ARG SERVER_NAME ARG SERVER_NAME
ENV SERVER_NAME=${SERVER_NAME} ENV SERVER_NAME=${SERVER_NAME}
COPY start.sh /opt/start.sh COPY ./docker/ /opt/
COPY ${SERVER_NAME}*.jar /opt/
RUN chmod -R 755 /opt/ RUN chmod -R 755 /opt/

View File

@ -5,13 +5,13 @@ set -e
echo "############## start ##############" echo "############## start ##############"
BUILD_DATE=`date +%Y-%m-%d:%H:%M:%S` BUILD_DATE=`date +%Y-%m-%d:%H:%M:%S`
CURR_DIR=`basename $PWD` #CURR_DIR=`basename $PWD`
if [[ ${CURR_DIR} != "docker" ]]; then #if [[ ${CURR_DIR} != "docker" ]]; then
echo "############## must exec in docker dir ##############" # echo "############## must exec in docker dir ##############"
exit 2; # exit 2;
fi #fi
#
cd ../ #cd ../
#SERVER_NAME=`awk '/<name>[^<]+<\/name>/{gsub(/<name>|<\/name>/,"",$1);print $1;exit;}' pom.xml` #SERVER_NAME=`awk '/<name>[^<]+<\/name>/{gsub(/<name>|<\/name>/,"",$1);print $1;exit;}' pom.xml`
#SERVER_NAME=$(basename `pwd`) #SERVER_NAME=$(basename `pwd`)
SERVER_NAME=${MODULE_PARMS} SERVER_NAME=${MODULE_PARMS}
@ -25,7 +25,7 @@ else
fi fi
cp ${SERVER_JAR} ./docker cp ${SERVER_JAR} ./docker
cd docker #cd docker
if [[ ${DOCKER_IMAGE_TAG} ]];then if [[ ${DOCKER_IMAGE_TAG} ]];then
image_tag=${DOCKER_IMAGE_TAG} image_tag=${DOCKER_IMAGE_TAG}
@ -39,13 +39,13 @@ echo "############## image_tag is: ${image_tag} ##############"
base_url=docker.ehlxr.me base_url=docker.ehlxr.me
docker_url=${base_url}/ehlxr/${SERVER_NAME}:${image_tag} docker_url=${base_url}/ehlxr/${SERVER_NAME}:${image_tag}
docker build --build-arg SERVER_NAME=${SERVER_NAME} -f ./Dockerfile -t ${docker_url} . docker build --build-arg SERVER_NAME=${SERVER_NAME} -f ./docker/Dockerfile -t ${docker_url} .
# get user pwd from environment # get user pwd from environment
echo "${DOCKER_REGISTRY_PWD}" | docker login --username ${DOCKER_REGISTRY_USER} --password-stdin ${base_url} echo "${DOCKER_REGISTRY_PWD}" | docker login --username ${DOCKER_REGISTRY_USER} --password-stdin ${base_url}
docker push ${docker_url} docker push ${docker_url}
rm ${SERVER_NAME}*.jar rm ./docker/${SERVER_NAME}*.jar
echo "############## build & push finish: ${BUILD_DATE} ##############" echo "############## build & push finish: ${BUILD_DATE} ##############"
err=$? err=$?