mirror of
https://github.com/yeasy/docker_practice.git
synced 2026-03-26 03:35:31 +00:00
Add blank lines around headers
This commit is contained in:
@@ -120,6 +120,7 @@ require (
|
||||
// 如果需要依赖
|
||||
)
|
||||
```
|
||||
|
||||
#### 带依赖的 Go 应用
|
||||
|
||||
**应用代码(使用 Gin 框架):**
|
||||
@@ -182,6 +183,7 @@ EXPOSE 8080
|
||||
|
||||
CMD ["./app"]
|
||||
```
|
||||
|
||||
### 21.7.2 Rust 应用的最小化镜像构建
|
||||
|
||||
Rust 因其性能和安全性在系统级应用中备受青睐。
|
||||
@@ -273,6 +275,7 @@ curl http://localhost:8080/health | jq .
|
||||
# Rust 应用通常比 Go 更小:5-20MB(取决于依赖)
|
||||
docker images rust-app
|
||||
```
|
||||
|
||||
### 21.7.3 数据库容器化最佳实践
|
||||
|
||||
#### PostgreSQL 生产部署
|
||||
@@ -455,6 +458,7 @@ services:
|
||||
volumes:
|
||||
postgres_data:
|
||||
```
|
||||
|
||||
#### MySQL/MariaDB 部署
|
||||
|
||||
```dockerfile
|
||||
@@ -495,6 +499,7 @@ server_id = 1
|
||||
log_bin = mysql-bin
|
||||
binlog_format = ROW
|
||||
```
|
||||
|
||||
#### Redis 缓存部署
|
||||
|
||||
```dockerfile
|
||||
@@ -545,6 +550,7 @@ client-output-buffer-limit normal 0 0 0
|
||||
client-output-buffer-limit slave 256mb 64mb 60
|
||||
client-output-buffer-limit pubsub 32mb 8mb 60
|
||||
```
|
||||
|
||||
### 21.7.4 微服务架构的 Docker Compose 编排
|
||||
|
||||
**三层微服务架构示例:**
|
||||
@@ -736,6 +742,7 @@ server {
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 21.7.5 使用 VS Code Dev Containers
|
||||
|
||||
Dev Containers 让整个开发环境容器化,提升团队一致性。
|
||||
|
||||
Reference in New Issue
Block a user