mirror of https://github.com/halo-dev/halo
🎨 docker自动集成
parent
1167bceb6c
commit
2d2274a4ea
|
@ -4,9 +4,9 @@ LABEL maintainer="Ryan Wang<i@ryanc.cc>"
|
||||||
WORKDIR /opt/halo
|
WORKDIR /opt/halo
|
||||||
ADD . /tmp
|
ADD . /tmp
|
||||||
|
|
||||||
RUN cd /tmp && mvn package -Pprod && mv target/dist/halo/* /opt/halo/ \
|
RUN cd /tmp && mvn package -Pci && mv target/dist/halo/* /opt/halo/ \
|
||||||
&& rm -rf /tmp/* && rm -rf ~/.m2
|
&& rm -rf /tmp/* && rm -rf ~/.m2
|
||||||
|
|
||||||
EXPOSE 8090
|
EXPOSE 8090
|
||||||
|
|
||||||
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/opt/halo/app.jar"]
|
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-jar","/opt/halo/halo-latest.jar","--spring.profiles.active=docker"]
|
||||||
|
|
81
pom.xml
81
pom.xml
|
@ -172,24 +172,97 @@
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<!-- 生产环境打包配置 -->
|
||||||
|
<profile>
|
||||||
|
<id>prod</id>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>aliyun</id>
|
<id>aliyun</id>
|
||||||
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
|
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<pluginRepositories>
|
<pluginRepositories>
|
||||||
<pluginRepository>
|
<pluginRepository>
|
||||||
<id>aliyun</id>
|
<id>aliyun</id>
|
||||||
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
|
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
|
||||||
</pluginRepository>
|
</pluginRepository>
|
||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
|
<build>
|
||||||
|
<finalName>halo</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/*.java</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<!-- 跳过单元测试,不然打包的时候会因为加载不了application.yaml报错 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<profiles>
|
<plugin>
|
||||||
<!-- 生产环境打包配置 -->
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.8</source>
|
||||||
|
<target>1.8</target>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<appendAssemblyId>false</appendAssemblyId>
|
||||||
|
<descriptors>
|
||||||
|
<descriptor>assembly.xml</descriptor>
|
||||||
|
</descriptors>
|
||||||
|
<outputDirectory>${project.build.directory}/dist/</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- 打包成jar文件,并指定lib文件夹以及resources资源文件夹 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>cc.ryanc.halo.Application</mainClass>
|
||||||
|
<classpathPrefix>lib/</classpathPrefix>
|
||||||
|
<addClasspath>true</addClasspath>
|
||||||
|
</manifest>
|
||||||
|
<manifestEntries>
|
||||||
|
<Class-Path>resources/</Class-Path>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<!--CI环境-->
|
||||||
<profile>
|
<profile>
|
||||||
<id>prod</id>
|
<id>ci</id>
|
||||||
<build>
|
<build>
|
||||||
<finalName>halo</finalName>
|
<finalName>halo</finalName>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
server:
|
||||||
|
port: 8090
|
||||||
|
use-forward-headers: true
|
||||||
|
undertow:
|
||||||
|
io-threads: 2
|
||||||
|
worker-threads: 36
|
||||||
|
buffer-size: 1024
|
||||||
|
directBuffers: true
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
type: com.alibaba.druid.pool.DruidDataSource
|
||||||
|
|
||||||
|
# H2database 配置
|
||||||
|
driver-class-name: org.h2.Driver
|
||||||
|
url: jdbc:h2:file:~/halo/halo
|
||||||
|
username: admin
|
||||||
|
password: 123456
|
||||||
|
|
||||||
|
#MySql配置
|
||||||
|
# driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
# url: jdbc:mysql://127.0.0.1:3306/halodb?characterEncoding=utf8&useSSL=false
|
||||||
|
# username: root
|
||||||
|
# password: 123456
|
||||||
|
|
||||||
|
h2:
|
||||||
|
console:
|
||||||
|
settings:
|
||||||
|
web-allow-others: false
|
||||||
|
path: /h2-console
|
||||||
|
enabled: true
|
||||||
|
jpa:
|
||||||
|
hibernate:
|
||||||
|
ddl-auto: update
|
||||||
|
show-sql: false
|
||||||
|
freemarker:
|
||||||
|
allow-request-override: false
|
||||||
|
cache: false
|
||||||
|
check-template-location: true
|
||||||
|
charset: utf-8
|
||||||
|
content-type: text/html
|
||||||
|
expose-request-attributes: false
|
||||||
|
expose-session-attributes: false
|
||||||
|
expose-spring-macro-helpers: true
|
||||||
|
suffix: .ftl
|
||||||
|
settings:
|
||||||
|
auto_import: /spring.ftl as spring
|
||||||
|
servlet:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 10MB
|
||||||
|
max-request-size: 10MB
|
||||||
|
|
||||||
|
# 多语言资源文件路径
|
||||||
|
messages:
|
||||||
|
basename: i18n/messages
|
||||||
|
logging:
|
||||||
|
file: ./logs/log.log
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue