add docker

This commit is contained in:
none 2023-04-06 16:17:17 +08:00
parent 943c25ffb0
commit 28b9bb6495
7 changed files with 35 additions and 20 deletions

View File

@ -1,11 +1,12 @@
FROM openjdk:17
MAINTAINER 杭州白书科技有限公司 "tengyongzhi@meedu.vip"
FROM openjdk:17-slim
WORKDIR /app
# 使用东八区时间环境
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# 将指定目录下的jar包复制到docker容器的/目录下
COPY /target/*.jar /app.jar
COPY /target/playedu-api-*.jar /app/app.jar
# 声明服务运行在8080端口
EXPOSE 9898

13
docker-build.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
echo '设置M2_HOME...'
cp -r docker/.m2 /root
ls /root/.m2
echo '开始打包...'
export MAVEN_OPTS=-Dmaven.test.skip=true
/app/mvnw clean package

13
docker/.m2/settings.xml Executable file
View File

@ -0,0 +1,13 @@
<?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>ali</id>
<name>ali Maven</name>
<mirrorOf>*</mirrorOf>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
</settings>

View File

@ -16,6 +16,7 @@
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -8,7 +8,7 @@ spring:
proxy-target-class: true
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: "jdbc:mysql://127.0.0.1:33060/java-meedu?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false"
url: "jdbc:mysql://192.168.3.9:33060/java-meedu?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false"
username: "root"
password: "root"
type: com.zaxxer.hikari.HikariDataSource
@ -19,7 +19,7 @@ spring:
# Redis配置
data:
redis:
host: "127.0.0.1"
host: "192.168.3.9"
port: 6379
password:
database: 0
@ -46,7 +46,7 @@ spring:
minio:
access-key: "username"
secret-key: "password"
end-point: "http://127.0.0.1:9000"
end-point: "http://192.168.3.9:9000"
bucket: "playedu"
domain: "https://dev-local3.meedu.vip/"

View File

@ -6,7 +6,7 @@
<!-- 定义参数 -->
<property name="log.lever" value="debug"/>
<property name="log.maxHistory" value="365"/>
<property name="log.filePath" value="logs"></property>
<property name="log.filePath" value="logs" />
<property name="log.pattern" value="%-12(%d{yyyy-MM-dd HH:mm:ss.SSS}) |-%-5level [%thread] %c [%L] -| %msg%n"/>
<!-- 控制台设置 -->

View File

@ -1,13 +0,0 @@
package xyz.playedu.api;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class PlayeduApiApplicationTests {
@Test
void contextLoads() {
}
}