<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring‐boot‐maven‐plugin</artifactId>
</plugin>
</plugins>
</build>
<?xml version="1.0" encoding="UTF‐8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema‐instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven‐4.0.0.xsd">
<parent>
<artifactId>xc‐framework‐parent</artifactId>
<groupId>com.xuecheng</groupId>
<version>1.0‐SNAPSHOT</version>
<relativePath>../xc‐framework‐parent/pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>xc‐govern‐center</artifactId>
<dependencies>
<!‐‐ 导入Eureka服务的依赖 ‐‐>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring‐cloud‐starter‐netflix‐eureka‐server</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}‐${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring‐boot‐maven‐plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
FROM java:8
ENV ARTIFACTID xc‐govern‐center
ENV ARTIFACTVERSION 1.0‐SNAPSHOT
ENV HOME_PATH /home
WORKDIR $HOME_PATH
ADD /$ARTIFACTID‐$ARTIFACTVERSION.jar $HOME_PATH/$ARTIFACTID.jar
ENTRYPOINT ["java", "‐jar", "xc‐govern‐center.jar"]
[root@localhost xc‐govern‐center]# docker images
REPOSITORY TAG IMAGE ID
CREATED SIZE
xc‐govern‐center 1.0‐SNAPSHOT
ad14dcce6666 35 seconds ago 684 MB
docker create ‐‐name xc‐govern‐center‐test ‐t ‐p 50101:50101 ‐e PORT=50101 ‐e
EUREKA_SERVER=http://192.168.101.64:50101/eureka/,http://192.168.101.64:50102/eureka/ xc‐
govern‐center:1.0‐SNAPSHOT
[root@localhost xc‐govern‐center]# docker ps
CONTAINER ID IMAGE COMMAND CREATED
STATUS PORTS NAMES
688cabeef187 xc‐govern‐center:1.0‐SNAPSHOT "java ‐jar xc‐gove..." 2 minutes ago
Up 2 minutes 0.0.0.0:50101‐>50101/tcp xc‐govern‐center‐
test
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |