Skip to content

Commit 582f92e

Browse files
author
“whgojp”
committed
add docker support
1 parent fa0f5d8 commit 582f92e

File tree

17 files changed

+179
-65
lines changed

17 files changed

+179
-65
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ build/
3434
### Mac OS ###
3535
.DS_Store
3636

37-
/log/
37+
/logs/

Dockerfile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
FROM ubuntu:latest
2-
LABEL authors="whgojp"
1+
FROM openjdk:8
32

4-
ENTRYPOINT ["top", "-b"]
3+
WORKDIR /work
4+
5+
LABEL maintainer="whgojp@foxmail.com"
6+
LABEL version="1.0"
7+
LABEL description="I think therefore I am."
8+
9+
COPY target/JavaSecLab.jar /work/JavaSecLab.jar
10+
11+
EXPOSE 8080
12+
EXPOSE 9090
13+
14+
ENV IMAGE_NAME=JavaSecLab
15+
16+
ENTRYPOINT ["java", "-jar", "JavaSecLab.jar"]

docker-compose.yml

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,39 @@
11
version: "3"
2-
networks:
3-
driver-all-network:
4-
external: true
5-
62
services:
7-
nps:
8-
image: ffdfgdfg/nps:v0.26.10
9-
container_name: nps
10-
hostname: nps
3+
mysql:
4+
image: mysql:8.0.33
5+
container_name: Container-MYSQL8
116
restart: always
127
ports:
13-
- 80:80
14-
- 443:443
15-
- 8080:8080
16-
- 18024:8024
17-
- 8011-8051:8011-8051
8+
- 3306:3306
9+
environment:
10+
MYSQL_ROOT_PASSWORD: QWE123qwe
11+
MYSQL_DATABASE: JavaSecLab
1812
volumes:
19-
- /etc/nps/conf:/conf
20-
privileged: true
13+
- ./sql/JavaSecLab.sql:/docker-entrypoint-initdb.d/JavaSecLab.sql
14+
networks:
15+
- JavaSecLabNet
16+
17+
JavaSecLab:
18+
image: backend:1.0
19+
container_name: Container-JavaSecLab
20+
restart: always
21+
build: .
22+
ports:
23+
- 8080:8080
24+
- 9090:9090
2125
environment:
22-
TZ: Asia/Shanghai
23-
LANG: en_US.UTF-8
24-
# networks:
25-
# driver-all-network:
26-
# ipv4_address: "172.30.1.2"
26+
- TZ=Asia/Shanghai # 设置时区为上海(GMT+8)
27+
depends_on:
28+
- mysql
29+
volumes:
30+
- ./logs:/logs # 记录日志信息
31+
networks:
32+
- JavaSecLabNet
33+
34+
networks:
35+
JavaSecLabNet:
36+
driver: bridge
37+
ipam:
38+
config:
39+
- subnet: 192.168.66.0/24

pic/login.png

1.15 MB
Loading

pic/logo.png

128 KB
Loading

pom.xml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<groupId>top.whgojp</groupId>
88
<artifactId>JavaSecLab</artifactId>
99
<version>1.0.0</version>
10-
<name>Java安全平台</name>
10+
<name>Java综合漏洞平台</name>
1111
<description>hello JavaSec!</description>
1212
<parent>
1313
<groupId>org.springframework.boot</groupId>
@@ -27,7 +27,7 @@
2727
<jwt.version>0.10.7</jwt.version>
2828
</properties>
2929
<dependencies>
30-
<!-- 热加载-->
30+
<!-- 热加载-->
3131
<dependency>
3232
<groupId>org.springframework.boot</groupId>
3333
<artifactId>spring-boot-devtools</artifactId>
@@ -127,6 +127,27 @@
127127
</dependency>
128128

129129
</dependencies>
130+
<build>
131+
<finalName>JavaSecLab</finalName>
132+
<plugins>
133+
<!-- maven 打包时跳过测试 -->
134+
<plugin>
135+
<groupId>org.apache.maven.plugins</groupId>
136+
<artifactId>maven-surefire-plugin</artifactId>
137+
<configuration>
138+
<skip>true</skip>
139+
</configuration>
140+
</plugin>
141+
<plugin>
142+
<groupId>org.springframework.boot</groupId>
143+
<artifactId>spring-boot-maven-plugin</artifactId>
144+
<configuration>
145+
<mainClass>top.whgojp.Application</mainClass>
146+
<skip></skip>
147+
</configuration>
148+
</plugin>
149+
</plugins>
150+
</build>
130151
<repositories>
131152
<repository>
132153
<id>acfunnexus</id>

sql/JavaSecLab.sql

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/*
2+
Navicat Premium Data Transfer
3+
4+
Source Server : mysql_docker_mac
5+
Source Server Type : MySQL
6+
Source Server Version : 80200 (8.2.0)
7+
Source Host : localhost:13306
8+
Source Schema : JavaSecLab
9+
10+
Target Server Type : MySQL
11+
Target Server Version : 80200 (8.2.0)
12+
File Encoding : 65001
13+
14+
Date: 22/06/2024 17:35:45
15+
*/
16+
CREATE DATABASE IF NOT EXISTS JavaSecLab;
17+
USE JavaSecLab;
18+
19+
SET NAMES utf8mb4;
20+
SET FOREIGN_KEY_CHECKS = 0;
21+
22+
-- ----------------------------
23+
-- Table structure for log
24+
-- ----------------------------
25+
DROP TABLE IF EXISTS `log`;
26+
CREATE TABLE `log` (
27+
`logId` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT 'log_id',
28+
`username` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户名',
29+
`optionName` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '用户操作',
30+
`optionTerminal` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '操作终端',
31+
`optionIp` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'Ip地址',
32+
`optionTime` date DEFAULT NULL COMMENT '创建时间',
33+
PRIMARY KEY (`logId`)
34+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
35+
36+
-- ----------------------------
37+
-- Records of log
38+
-- ----------------------------
39+
BEGIN;
40+
COMMIT;
41+
42+
-- ----------------------------
43+
-- Table structure for user
44+
-- ----------------------------
45+
DROP TABLE IF EXISTS `user`;
46+
CREATE TABLE `user` (
47+
`username` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名',
48+
`password` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '密码',
49+
PRIMARY KEY (`username`)
50+
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
51+
52+
-- ----------------------------
53+
-- Records of user
54+
-- ----------------------------
55+
BEGIN;
56+
INSERT INTO `user` (`username`, `password`) VALUES ('admin', 'admin');
57+
COMMIT;
58+
59+
-- ----------------------------
60+
-- Table structure for xss
61+
-- ----------------------------
62+
DROP TABLE IF EXISTS `xss`;
63+
CREATE TABLE `xss` (
64+
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键id',
65+
`content` text COLLATE utf8mb4_general_ci NOT NULL COMMENT '插入内容',
66+
`date` varchar(255) COLLATE utf8mb4_general_ci NOT NULL COMMENT '插入时间',
67+
PRIMARY KEY (`id`)
68+
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
69+
70+
-- ----------------------------
71+
-- Records of xss
72+
-- ----------------------------
73+
BEGIN;
74+
INSERT INTO `xss` (`id`, `content`, `date`) VALUES (34, '1', '2024-06-11 14:29:36');
75+
COMMIT;
76+
77+
SET FOREIGN_KEY_CHECKS = 1;

src/main/java/top/whgojp/Application.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import lombok.SneakyThrows;
44
import lombok.extern.slf4j.Slf4j;
5+
import org.mybatis.spring.annotation.MapperScan;
56
import org.springframework.beans.factory.annotation.Autowired;
67
import org.springframework.boot.SpringApplication;
78
import org.springframework.boot.autoconfigure.SpringBootApplication;

src/main/java/top/whgojp/common/config/MyBatisPlusConfig.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.springframework.context.annotation.Bean;
88
import org.springframework.context.annotation.Configuration;
99

10-
//@Configuration
1110
//@EnableTransactionManagement
1211
@MapperScan(basePackages={"top.whgojp.modules.*.mapper","top.whgojp.modules.*.*.mapper"})
1312
//@ConditionalOnBean(value = DataSource.class)

src/main/java/top/whgojp/modules/system/entity/User.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class User implements Serializable {
1717
/**
1818
* 用户名
1919
*/
20+
@TableId(type = IdType.AUTO)
2021
private String username;
2122

2223
/**

0 commit comments

Comments
 (0)