zoukankan      html  css  js  c++  java
  • Docker私有仓库实例

    C:Users	hink.m2settings.xml文件配置:

    <?xml version="1.0" encoding="UTF-8"?> <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <mirrors> <mirror> <id>nexus</id> <mirrorOf>*</mirrorOf> <url>http://maven.kjt.com/nexus/content/groups/public</url> </mirror> </mirrors> <servers> <server> <id>releases</id> <username>p_user</username> <password>p_password</password> </server> <server> <id>snapshots</id> <username>p_user</username> <password>p_password</password> </server> <server> <id>docker-hub</id> <username>p_password</username> <password>p_password</password> <configuration> <email>docker@xxx.com</email> </configuration> </server> </servers> <profiles> <profile> <id>nexus</id> <repositories> <repository> <id>central</id> <url>http://repo1.maven.org/maven2/</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://central</url> <releases> <enabled>true</enabled> </releases> <snapshots> <enabled>true</enabled> </snapshots> </pluginRepository> </pluginRepositories> </profile> <profile> <id>dev</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <releases.repo>http://maven.kjt.com/nexus/content/repositories/releases</releases.repo> <snapshots.repo>http://maven.kjt.com/nexus/content/repositories/snapshots</snapshots.repo> </properties> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> </settings>
    pom.xml
    <?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"> <modelVersion>4.0.0</modelVersion> <groupId>com.backportal</groupId> <artifactId>backportal</artifactId> <version>0.0.1</version> <packaging>jar</packaging> <name>com.backportal</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.10.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <thymeleaf.version>3.0.9.RELEASE</thymeleaf.version> <!-- 布局功能的支持程序 thymeleaf3主程序 layout2以上版本 --> <!-- thymeleaf2 layout1--> <thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version> <docker.repostory>docker.xxx.com</docker.repostory> <docker.dockerhost>http://192.168.xx.xx:xxxx</docker.dockerhost> <docker.registry.name>x_project/xxx</docker.registry.name> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <!-- 引入web模块 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <artifactId>spring-boot-starter-logging</artifactId> <groupId>org.springframework.boot</groupId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <!--引入jquery-webjar--> <dependency> <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <version>3.3.1</version> </dependency> <!--引入bootstrap--> <dependency> <groupId>org.webjars</groupId> <artifactId>bootstrap</artifactId> <version>4.0.0</version> </dependency> <!--引入阿里druid连接池监控--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid</artifactId> <version>1.1.8</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.8.0-beta2</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <finalName>${project.artifactId}</finalName> </configuration> </plugin> <plugin> <groupId>com.spotify</groupId> <artifactId>docker-maven-plugin</artifactId> <version>0.4.13</version> <executions> <execution> <id>build-image</id> <phase>package</phase> <goals> <goal>build</goal> </goals> </execution> <execution> <id>push-image</id> <phase>deploy</phase> <goals> <goal>push</goal> </goals> <configuration> <imageName>${docker.repostory}/${docker.registry.name}:${project.version}</imageName> </configuration> </execution> </executions> <configuration> <serverId>docker-hub</serverId> <registryUrl>https://${docker.repostory}</registryUrl> <dockerHost>${docker.dockerhost}</dockerHost> <dockerDirectory>${project.basedir}</dockerDirectory> <pushImage>true</pushImage> <imageName> ${docker.repostory}/${docker.registry.name}:${project.version} </imageName> <imageTags> <imageTag>latest</imageTag> </imageTags> <resources> <resource> <directory>${project.build.directory}</directory> <include>${project.build.finalName}.jar</include> </resource> </resources> </configuration> </plugin> </plugins> </build> </project>
    Dockerfile文件设置
    
    FROM java:8-jre
    MAINTAINER windMan <wen.chao@kjt.com>
    ENV TZ=Asia/Shanghai
    RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
    
    ADD ./target/backportal.jar /app/
    CMD ["java", "-Duser.timezone=GMT+8", "-jar", "/app/backportal.jar"]
    
    EXPOSE 外部暴露端口(注意:外部端口不可以重复,内部端口和外部端口可以重复)
  • 相关阅读:
    Restful API
    事件冒泡
    DOM性能
    获取dom节点的所有子节点
    获取dom节点的父节点
    深拷贝
    Dropdown下拉菜单
    Breadcrumb面包屑
    【vue】----生产环境去除cosole.*
    刷leetcode时,重新认识LinkedList实现栈、队列或者双端队列
  • 原文地址:https://www.cnblogs.com/cykj/p/Docker-house.html
Copyright © 2011-2022 走看看