Dockerfile打包SpringBoot项目并部署到服务器的Docker上

Dockerfile内容

FROM openjdk:8-jdk-alpine
VOLUME /tmp
ARG JAR_FILE
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
image

修改pom.xml文件









-->


    learn_beetlsql
    
    
    


    
        
        yoonada
    


    
        
        learn_beetlsql
        
            
            
            
            

            
                com.spotify
                dockerfile-maven-plugin
                1.3.6
                
                    ${docker.image.prefix}/${project.artifactId}
                    
                        target/${project.build.finalName}.jar
                    
                
            

        
    




mvn install dockerfile:build


image

docker login --username=yoonadada registry.cn-shenzhen.aliyuncs.com
输入密码

docker tag 3710ab14720a registry.cn-shenzhen.aliyuncs.com/yoonada/da:learn_beetlsql-v20200703
image


docker push registry.cn-shenzhen.aliyuncs.com/yoonada/da:learn_beetlsql-v20200703
image

image

docker login --username=yoonadada registry.cn-shenzhen.aliyuncs.com
输入密码

docker pull registry.cn-shenzhen.aliyuncs.com/yoonada/da:learn_beetlsql-v20200703



docker run -d --name learn_beetlsql -p 8898:8899 3710ab14720a


docker ps -a

docker logs -f e4410320dcc7
image

你可能感兴趣的:(Dockerfile打包SpringBoot项目并部署到服务器的Docker上)