dockerFile 完成
This commit is contained in:
parent
b167e904c8
commit
01111c9709
21
Dockerfile
Normal file
21
Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM openjdk:8-jdk-slim
|
||||
MAINTAINER 1667834841@qq.com
|
||||
|
||||
# 环境变量
|
||||
ARG JAR_NAME=oneManager-java.jar
|
||||
ARG WORK_PATH=/opt/jar
|
||||
ENV JAR_NAME JAR_NAME
|
||||
ENV WORK_PATH WORK_PATH
|
||||
|
||||
|
||||
# 创建jar目录
|
||||
RUN mkdir ${WORK_PATH}
|
||||
# 设置工作目录
|
||||
WORKDIR ${WORK_PATH}
|
||||
|
||||
COPY ./target/oneManager-java.jar ${WORK_PATH}/${JAR_NAME}
|
||||
|
||||
EXPOSE 8081
|
||||
|
||||
CMD java -jar ${WORK_PATH}/${JAR_NAME} --spring.profiles.active=dev
|
||||
|
16
README.md
16
README.md
@ -11,6 +11,18 @@
|
||||
|
||||
**OneManager-java**是基于[OneManager-php](https://github.com/qkqpttgf/OneManager-php) 的原型上二次开发的一款基于**SpringBoot**的Java网盘程序
|
||||
|
||||
### start
|
||||
|
||||
#### windows
|
||||
执行`start.bat`文件
|
||||
再在运行idea里运行,或者 在当前目录执行`java -jar oneManager-java.jar --spring.profiles.active=prod`
|
||||
|
||||
#### docker
|
||||
```shell
|
||||
docker run -p 8081:8081 --rm -d --name onemanager-java ggball/onemanager-java:1.0
|
||||
```
|
||||
|
||||
用浏览器打开 `http://localhost:8081/`
|
||||
|
||||
|
||||
### TODO
|
||||
@ -23,7 +35,7 @@
|
||||

|
||||
|
||||
#### 2022-01
|
||||
- [ ] 分页列表
|
||||
- [ ] ~~分页列表~~
|
||||
- [ ] 定时任务 将指定目录网盘数据,交给es,es并创建索引
|
||||
- [ ] 文件的上传,删除
|
||||
- [X] 文件的上传,删除
|
||||
- [ ] md文件的修改
|
22
pom.xml
22
pom.xml
@ -147,8 +147,30 @@
|
||||
|
||||
</plugin>
|
||||
|
||||
|
||||
|
||||
</plugins>
|
||||
|
||||
<resources>
|
||||
<resource>
|
||||
|
||||
<directory>${basedir}/src/main/resources</directory>
|
||||
<includes>
|
||||
|
||||
<include>**/*.yaml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.config</include>
|
||||
<include>**/*.txt</include>
|
||||
<include>sql/**</include>
|
||||
<include>static/**</include>
|
||||
<include>templates/**</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>/webapp/node_modules</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
@ -1,9 +1,13 @@
|
||||
package com.zhu.onemanager.constant;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import com.zhu.onemanager.utlis.FileUtils;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
/**
|
||||
* @author ggBall
|
||||
|
@ -70,7 +70,7 @@ public class AuthTokenImpl implements AuthToken {
|
||||
throw new AppException(ResponseEnum.CONFIG_INVALID);
|
||||
}
|
||||
|
||||
Map map = FileUtils.readMap(PathConstant.TOKEN_PATH, FileConstant.KV_SEPARATOR);
|
||||
Map map = FileUtils.readToken(PathConstant.TOKEN_PATH, FileConstant.KV_SEPARATOR);
|
||||
if (null != map && map.size() > 0) {
|
||||
config.setRefreshToken(String.valueOf(map.get("refreshToken")));
|
||||
} else if (config.getRefreshToken() == null || config.getAccessToken() == null) {
|
||||
|
@ -5,11 +5,14 @@ import cn.hutool.core.util.CharsetUtil;
|
||||
import com.zhu.onemanager.constant.FileConstant;
|
||||
import com.zhu.onemanager.constant.PathConstant;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.xml.soap.SAAJResult;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -37,7 +40,7 @@ public class FileUtils {
|
||||
* @return void
|
||||
**/
|
||||
public static void write(Map map , String path) throws IOException {
|
||||
File file = FileUtil.file(PathConstant.getFilePath(path));
|
||||
File file = FileUtil.file(path);
|
||||
if (FileUtil.exist(file)) {
|
||||
// 文件清空
|
||||
FileUtil.writeUtf8String("",file);
|
||||
@ -46,6 +49,7 @@ public class FileUtils {
|
||||
FileUtil.writeUtf8Map(map,file, FileConstant.KV_SEPARATOR,false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Author ggball
|
||||
* @Description 读取文件 返回map
|
||||
@ -71,6 +75,36 @@ public class FileUtils {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Author ggball
|
||||
* @Description springboot 打成jar 文件形式读取不了jar里面的文件 所以专门写了这个
|
||||
* @Date 2022/1/12
|
||||
* @Param [path, separator]
|
||||
* @return java.util.Map
|
||||
**/
|
||||
public static Map readToken(String path,String separator) throws IOException {
|
||||
String values = "";
|
||||
ClassPathResource resource = new ClassPathResource(path);
|
||||
try {
|
||||
byte[] binaryData = FileCopyUtils.copyToByteArray(resource.getInputStream());
|
||||
values = new String(binaryData, StandardCharsets.UTF_8);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
String[] lines = values.split("\r\n");
|
||||
for (String line : lines) {
|
||||
String[] split = line.split(separator);
|
||||
map.put(split[0],split[1]);
|
||||
}
|
||||
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @Author ggball
|
||||
|
@ -1,7 +0,0 @@
|
||||
#jdbc.driverClass=com.mysql.jdbc.Driver
|
||||
#jdbc.url=jdbc:mysql://127.0.0.1:3306/onemanager?useUnicode=true&characterEncoding=utf-8&useSSL=false
|
||||
#jdbc.user=root
|
||||
#jdbc.password=root
|
||||
#
|
||||
#group.package=com.dnslin.onemanager
|
||||
#catalog.name=onemanager
|
@ -1,7 +1,7 @@
|
||||
'use strict'
|
||||
require('./check-versions')()
|
||||
|
||||
process.env.NODE_ENV = 'production'
|
||||
process.env.NODE_ENV = 'development'
|
||||
|
||||
const ora = require('ora')
|
||||
const rm = require('rimraf')
|
||||
|
@ -6,11 +6,13 @@ const path = require('path')
|
||||
|
||||
module.exports = {
|
||||
dev: {
|
||||
// Template for index.html
|
||||
index: path.resolve(__dirname, '../../templates/index.html'),
|
||||
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../../'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
proxyTable: {},
|
||||
|
||||
// Various Dev Server settings
|
||||
host: 'localhost', // can be overwritten by process.env.HOST
|
||||
@ -50,7 +52,7 @@ module.exports = {
|
||||
// Paths
|
||||
assetsRoot: path.resolve(__dirname, '../../'),
|
||||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
assetsPublicPath: '/oneManagerjava',
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
module.exports = {
|
||||
NODE_ENV: '"production"',
|
||||
// BASE_URL:'"https://ggball.top/oneManagerjava/"'
|
||||
BASE_URL:'"http://localhost:8081/"'
|
||||
BASE_URL:'"https://ggball.top/oneManagerjava/"'
|
||||
// BASE_URL:'"http://localhost:8081/"'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user