Skip to content

Commit

Permalink
chore: 优化 docker 打包脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Jun 21, 2023
1 parent fd738c2 commit b42f2f3
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docker-compose-hub.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '3'
services:
nuxt3-blog:
image: terwer/nuxt3-blog:1.3.0
image: terwer/nuxt3-blog:latest
ports:
- "3000:3000"
env_file:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ services:
- ./.env.docker
restart: no
user: nuxt3-blog
image: terwer/nuxt3-blog:1.3.0
image: terwer/nuxt3-blog:latest
4 changes: 2 additions & 2 deletions docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pnpm nodeBuild
接着启动 node 服务器

```
node .output/server/index.mjs
NUXT_PUBLIC_DEFAULT_TYPE=siyuan node NUXT_PUBLIC_SIYUAN_API_URL=http://127.0.0.1:6806 node .output/server/index.mjs
```

然后打开
Expand All @@ -74,7 +74,7 @@ http://localhost:3000
```
pnpm nodeuild
docker compose up --build --remove-orphans
docker push terwer/nuxt3-blog:1.3.0
docker push terwer/nuxt3-blog:latest
```
最简单的使用

Expand Down
2 changes: 1 addition & 1 deletion scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/sh
#!/bin/bash

# 使用 Siyuan 构建配置
echo "Using Siyuan build config as SSE and SPA build."
Expand Down
2 changes: 1 addition & 1 deletion scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/sh
#!/bin/bash

# 使用 Siyuan 构建配置
echo "Using Siyuan build config as SSE and SPA build."
Expand Down
18 changes: 16 additions & 2 deletions scripts/docker.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!/usr/bin/sh
#!/bin/bash

# 使用 Docker 构建配置
echo "Using Docker build config as SSR build."

APP_VERSION=1.3.0

# 兼容 node 的构建
pnpm nodeBuild
docker compose up --build
docker compose up --build --remove-orphans

# 复制一份 terwer/nuxt3-blog:latest 镜像,并将它打上最新版本的标签
docker tag terwer/nuxt3-blog:latest terwer/nuxt3-blog:$APP_VERSION

# 登录 Docker Hub
# docker login

# 推送最新版本和 latest 标签
docker push terwer/nuxt3-blog:latest
docker push terwer/nuxt3-blog:$APP_VERSION
2 changes: 1 addition & 1 deletion scripts/node.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/sh
#!/bin/bash

# 使用 Node 构建配置
echo "Using Node build config as SSR build."
Expand Down
2 changes: 1 addition & 1 deletion scripts/serve.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/sh
#!/bin/bash

# 使用 Node 构建配置
echo "Using Node build config as SSR serve"
Expand Down
2 changes: 1 addition & 1 deletion scripts/vercel.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/sh
#!/bin/bash

# 使用 Vercel 构建配置
echo "Using Vercel build config as SSR build."
Expand Down
2 changes: 1 addition & 1 deletion utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const isUseSiyuanApi = () => {
const env = useRuntimeConfig()
// docker - 在 .env.docker 配置 NUXT_PUBLIC_DEFAULT_TYPE=siyuan
// vercel - 在环境变量配置 NUXT_PUBLIC_DEFAULT_TYPE=siyuan
// node - 启动参数加 NUXT_PUBLIC_DEFAULT_TYPE=siyuan node NUXT_PUBLIC_SIYUAN_API_URL=http://127.0.0.1:6806 .output/server.,js
// node - 启动参数加 NUXT_PUBLIC_DEFAULT_TYPE=siyuan node NUXT_PUBLIC_SIYUAN_API_URL=http://127.0.0.1:6806
// 插件SPA(PC客户端) - nuxt.siyuan.config.ts 写死 NUXT_PUBLIC_DEFAULT_TYPE: siyuan
// 插件SPA(Docker浏览器客户端)- nuxt.siyuan.config.ts 写死 NUXT_PUBLIC_DEFAULT_TYPE: siyuan
// 插件SPA(本地客户端浏览器)- nuxt.siyuan.config.ts 写死 NUXT_PUBLIC_DEFAULT_TYPE: siyuan
Expand Down

0 comments on commit b42f2f3

Please sign in to comment.