其他分享
首页 > 其他分享> > docker部署

docker部署

作者:互联网

pom里面的docker插件

           <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>${docker.plugin.version}</version>
                <configuration>
                    <imageName>${docker.registry.url}/blade/${project.artifactId}:${project.version}</imageName>
                    <dockerDirectory>${project.basedir}</dockerDirectory>
                    <dockerHost>${docker.registry.host}</dockerHost>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                    <registryUrl>${docker.registry.url}</registryUrl>
                    <serverId>${docker.registry.url}</serverId>
                    <pushImage>true</pushImage>
                </configuration>
            </plugin>

 

dockerfile文件

RUN mkdir -p /blade/desk  在docker目录下(将docker目录作为根目录),创建balde/desk目录。实际操作的时候,将jar包复制到这里
ADD ./target/blade-desk.jar ./app.jar  这里的.代表WORKDIR。将jar添加到docker镜像中。  ADD  源路径  目标路径
 
FROM anapsix/alpine-java:8_server-jre_unlimited

MAINTAINER smallchill@163.com

RUN mkdir -p /blade/desk

WORKDIR /blade/desk

EXPOSE 8105

ADD ./target/blade-desk.jar ./app.jar

ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]

CMD ["--spring.profiles.active=test"]

 

标签:部署,blade,jar,project,registry,desk,docker
来源: https://www.cnblogs.com/longsanshi/p/12788399.html