FROM openjdk:oraclelinux8
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
LABEL "author"="qiuqiuya"
LABEL "version"="1.0"
LABEL "email"="fortunate_qkm@163.com"
ADD *.jar app.jar
EXPOSE 8081
ENTRYPOINT ["java", "-jar", "-Duser.timezone=GMT+08", "-Dfile.encoding=UTF-8", "-Dsun.jnu.encoding=UTF-8", "/app.jar"]
- docker-compose-dev.yml 文件
version: "3"
services:
ci-cd-test:
container_name: ci-cd-test
image: ci-cd-test:${BUILD_NUMBER}
ports:
- "8081:8080"
restart: always
source /etc/profile
source ~/.zshrc
if [[ -a ".env" ]];
then rm -rf .env
fi
cd /Users/qiukangming/jenkins-build/ci-cd-test
echo BUILD_NUMBER=${BUILD_NUMBER} >> .env
docker build -t ci-cd-test:${BUILD_NUMBER} .
docker-compose -f docker-compose-dev.yml -p ci-cd-test stop
docker-compose -f docker-compose-dev.yml -p ci-cd-test up -d
source /etc/profile
if [[ -a ".env" ]];
then rm -rf .env
fi
cd /root/jenkins-build/ci-cd-test
echo BUILD_NUMBER=${BUILD_NUMBER} >> .env
docker build -t ci-cd-test:${BUILD_NUMBER} .
docker-compose -f docker-compose-dev.yml -p ci-cd-test stop
docker-compose -f docker-compose-dev.yml -p ci-cd-test up -d
|