feats(docker): add check db script

This commit is contained in:
oiov
2025-05-27 10:06:49 +08:00
parent 7c61b7fc44
commit 55aa93d117
10 changed files with 80 additions and 25 deletions

View File

@@ -46,6 +46,10 @@ COPY --from=builder /app/prisma ./prisma
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
# Check db
COPY scripts/entrypoint.sh /app/scripts/entrypoint.sh
RUN chmod +x /app/scripts/entrypoint.sh
EXPOSE 3000
ENV HOSTNAME=0.0.0.0

View File

@@ -14,15 +14,22 @@
- <20>😀 **权限管理**:方便审核的管理员面板
- 🔒 **安全可靠**:基于 Cloudflare 强大的 DNS API
## Screenshots
## 截图预览
![screenshot](https://wr.do/_static/images/light-preview.png)
![screenshot](https://wr.do/_static/images/example_01.png)
![screenshot](https://wr.do/_static/images/example_02.png)
![screenshot](https://wr.do/_static/images/example_03.png)
<table>
<tr>
<td><img src="https://wr.do/_static/images/light-preview.png" /></td>
<td><img src="https://wr.do/_static/images/example_02.png" /></td>
</tr>
<tr>
<td><img src="https://wr.do/_static/images/example_01.png" /></td>
<td><img src="https://wr.do/_static/images/realtime-globe.png" /></td>
</tr>
<tr>
<td><img src="https://wr.do/_static/images/example_03.png" /></td>
<td><img src="https://wr.do/_static/images/domains.png" /></td>
</tr>
</table>
## 快速开始

View File

@@ -17,13 +17,21 @@
## Screenshots
![screenshot](https://wr.do/_static/images/light-preview.png)
<table>
<tr>
<td><img src="https://wr.do/_static/images/light-preview.png" /></td>
<td><img src="https://wr.do/_static/images/example_02.png" /></td>
</tr>
<tr>
<td><img src="https://wr.do/_static/images/example_01.png" /></td>
<td><img src="https://wr.do/_static/images/realtime-globe.png" /></td>
</tr>
<tr>
<td><img src="https://wr.do/_static/images/example_03.png" /></td>
<td><img src="https://wr.do/_static/images/domains.png" /></td>
</tr>
</table>
![screenshot](https://wr.do/_static/images/example_02.png)
![screenshot](https://wr.do/_static/images/example_01.png)
![screenshot](https://wr.do/_static/images/example_03.png)
## Quick Start
@@ -50,7 +58,9 @@ Remember to fill in the necessary environment variables.
### Deploy with Docker Compose
Fill in the environment variables in the `docker-compose.yml`, then:
Create a new folder and copy the `docker-compose.yml` file to the folder.
Touch a `.env` file at the same level and fill in the environment variables, then:
```bash
docker compose up -d
@@ -87,7 +97,7 @@ Follow https://localhost:3000/setup
- Discord: https://discord.gg/AHPQYuZu3m
- 微信群:
![](https://wr.do/s/group)
<img width="300" src="https://wr.do/s/group" />
## License

View File

@@ -11,7 +11,9 @@ Remember to fill in the necessary environment variables.
## Deploy with Docker Compose
Fill in the environment variables in the `docker-compose.yml`, then:
Create a new folder and copy the `docker-compose.yml` file to the folder.
Touch a `.env` file at the same level and fill in the environment variables, then:
```bash
docker compose up -d

View File

@@ -15,13 +15,20 @@ description: Welcome to the WR.DO documentation.
## Screenshots
<img className="rounded-xl border mt-4 md:rounded-lg shadow-md" src="/_static/images/light-preview.png"/>
<img className="rounded-xl border mt-4 md:rounded-lg shadow-md" src="/_static/images/example_02.png"/>
<img className="rounded-xl border mt-4 md:rounded-lg shadow-md" src="/_static/images/example_01.png"/>
<img className="rounded-xl border mt-4 md:rounded-lg shadow-md" src="/_static/images/example_03.png"/>
<table>
<tr>
<td><img src="https://wr.do/_static/images/light-preview.png" /></td>
<td><img src="https://wr.do/_static/images/example_02.png" /></td>
</tr>
<tr>
<td><img src="https://wr.do/_static/images/example_01.png" /></td>
<td><img src="https://wr.do/_static/images/realtime-globe.png" /></td>
</tr>
<tr>
<td><img src="https://wr.do/_static/images/example_03.png" /></td>
<td><img src="https://wr.do/_static/images/domains.png" /></td>
</tr>
</table>
## Quick Start

View File

@@ -57,7 +57,7 @@ async function handleShortUrl(req: NextAuthRequest) {
password,
};
console.log("Tracking data:", trackingData, siteConfig.url);
// console.log("Tracking data:", trackingData, siteConfig.url);
const res = await fetch(`${siteConfig.url}/api/s`, {
method: "POST",

Binary file not shown.

After

Width:  |  Height:  |  Size: 219 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

25
scripts/entrypoint.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/bin/sh
# scripts/entrypoint.sh
# 数据库初始化
retries=3 # 重试次数
count=0
echo "Running database initialization..."
until pnpm db:push || [ $count -ge $retries ]; do
echo "Database initialization failed, retrying ($((count + 1))/$retries)..."
count=$((count + 1))
sleep 5
done
# 检查是否成功
if [ $count -ge $retries ]; then
echo "Database initialization failed after $retries attempts."
exit 1
fi
echo "Database initialization successful."
# 执行原始的启动命令
echo "Starting the application..."
exec "$@"