Commit 35267860 by wangguangchao

简单方式

parent 73469306
FROM adoptopenjdk/openjdk8:x86_64-alpine-jdk8u382-b05
MAINTAINER R&D(WH)@brilliance.com.cn
USER root
ENV WORKDIR=/workspace
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories \
&& apk update \
&& apk add unzip
ADD ./target/*.zip ./app.zip
RUN echo "starting RUN command" && \
unzip -qo app.zip -d $WORKDIR && \
chmod -R 772 $WORKDIR && \
chmod 772 $WORKDIR/config && \
chmod 772 $WORKDIR/bin
WORKDIR /workspace
EXPOSE 8769
\ No newline at end of file
# 基于哪个镜像
From java:8
# 复制文件到容器
ADD ./target/eureka-server-1.0-SNAPSHOT.jar /app.jar
# 声明需要暴露的端口
EXPOSE 8769
# 配置容器启动后执行的命令
ENTRYPOINT java ${JAVA_OPTS} -jar /app.jar
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
......@@ -21,8 +21,6 @@
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/profiles/local" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/profiles/dev" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
......
......@@ -17,9 +17,8 @@ spec:
version: v1
spec:
containers:
- image: rdwh/eurekaserver:latest
- image: 192.168.0.110:8062/rdwh/eurekaserver:latest
name: eureka-server
command: ['sh','-c','sh ./bin/startup.sh && sleep 3600']
ports:
- containerPort: 8769
---
......
......@@ -35,40 +35,6 @@
</dependency>
</dependencies>
<profiles>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<package.environment>local</package.environment>
<jar.version>-SNAPSHOT</jar.version>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<package.environment>dev</package.environment>
<jar.version>-SNAPSHOT</jar.version>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<package.environment>test</package.environment>
<jar.version>-TEST</jar.version>
</properties>
</profile>
<profile>
<id>prd</id>
<properties>
<package.environment>prd</package.environment>
<jar.version>-RELEASE</jar.version>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>brilliance-virtual</id>
......@@ -82,77 +48,17 @@
<build>
<plugins>
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <version>2.3.12.RELEASE</version>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <goals>-->
<!-- <goal>repackage</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<excludes>
<exclude>*.**</exclude>
<exclude>*/*.xml</exclude>
<exclude>config/**</exclude>
</excludes>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<useUniqueVersions>false</useUniqueVersions>
<mainClass>com.brilliance.hk.EurekaServerApplication</mainClass>
</manifest>
</archive>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.12.RELEASE</version>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
<goal>repackage</goal>
</goals>
</execution>
</executions>
<configuration>
<attach>true</attach>
<appendAssemblyId>false</appendAssemblyId>
<tarLongFileMode>gnu</tarLongFileMode>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
......
# 给当前服务取一个名字
spring.application.name=eureka
# 设置端口号
server.port=8769
logging.config=classpath:logback.xml
# Eureka Server 也是一个普通的微服务,所以当它还是一个注册中心的时候,他会有两层身份:1.注册中心;2.普通服务。
# 默认情况下,会把自己注册到自己上面来,设置为 false 时,表示当前项目不要注册到注册中心上
eureka.client.register-with-eureka=false
# 表示是否从 Eureka Server 上获取注册信息
eureka.client.fetch-registry=false
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment