Skip to content

新建分支-将代码全部提交 #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"python.testing.unittestArgs": [
"-v",
"-s",
"./doc",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.unittestEnabled": true
}
14 changes: 14 additions & 0 deletions blogserver/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 使用官方的 OpenJDK 作为基础镜像
FROM openjdk:11-jre-slim

# 设置工作目录
WORKDIR /app

# 复制构建好的 Spring Boot JAR 文件到容器中
COPY target/blogserver-0.0.1-SNAPSHOT.jar vblog.jar

# 暴露服务端口
EXPOSE 8083

# 启动 Spring Boot 应用
CMD ["java", "-jar", "vblog.jar"]
4 changes: 2 additions & 2 deletions blogserver/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.url=jdbc:mysql:///vueblog2?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=123
spring.datasource.password=Lx123456
mybatis.config-location=classpath:/mybatis-config.xml

server.port=8081
server.port=8083
logging.level.org.springframework.security=info
56 changes: 56 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
version: '3.8'

services:
mysql:
image: mysql:5.7
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: vueblog2
ports:
- "3306:3306"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
volumes:
- mysql_data:/var/lib/mysql
healthcheck: # 添加健康检查
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-prootpassword"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s

backend:
image: liuxiongxiong/vblog-backend:latest
ports:
- "8083:8083"
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/vueblog2
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: rootpassword
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
depends_on: # 确保 mysql 服务健康后再启动
mysql:
condition: service_healthy

frontend:
image: liuxiongxiong/vblog-frontend:latest
ports:
- "80:80"
logging:
driver: "json-file"
options:
max-size: "10m"
max-file: "3"
depends_on:
- backend

volumes:
mysql_data:

29 changes: 29 additions & 0 deletions vueblog/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 使用 Node.js 作为基础镜像
FROM node:14

# 设置工作目录
WORKDIR /app

# 复制 package.json 和 package-lock.json
COPY package*.json ./

# 安装依赖
RUN npm install

# 复制项目文件
COPY . .

# 构建项目
RUN npm run build

# 使用 Nginx 作为服务器
FROM nginx:alpine

# 复制构建好的文件到 Nginx 目录
COPY --from=0 /app/dist /usr/share/nginx/html

# 暴露 Nginx 端口
EXPOSE 80

# 启动 Nginx
CMD ["nginx", "-g", "daemon off;"]
2 changes: 1 addition & 1 deletion vueblog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"friendly-errors-webpack-plugin": "^1.6.1",
"html-webpack-plugin": "^2.30.1",
"node-notifier": "^5.1.2",
"node-sass": "^4.7.2",
"node-sass": "^4.14.1",
"optimize-css-assets-webpack-plugin": "^3.2.0",
"ora": "^1.2.0",
"portfinder": "^1.0.13",
Expand Down