Skip to content

Commit c2be0df

Browse files
committed
ready for public
1 parent 20f46b8 commit c2be0df

File tree

5 files changed

+100
-5
lines changed

5 files changed

+100
-5
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
LITESTREAM_ACCESS_KEY_ID=
22
LITESTREAM_SECRET_ACCESS_KEY=
33
LITESTREAM_S3_BUCKET=
4-
LITESTREAM_S3_ENDPOINT=https://s3.us-west-002.backblazeb2.com
4+
LITESTREAM_S3_ENDPOINT=https://custom-endpoint
55
LITESTREAM_S3_PATH=linkding

.github/workflows/publish.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,7 @@ jobs:
5454
tags: ${{ steps.meta.outputs.tags }}
5555
labels: ${{ steps.meta.outputs.labels }}
5656
platforms: linux/amd64,linux/arm64
57+
build-args: |
58+
VERSION=${{ github.ref_name }}
59+
BUILD_DATE=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.created'] }}
60+
VCS_REF=${{ github.sha }}

Dockerfile

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,46 @@
1+
# Build arguments for metadata
2+
ARG VERSION="latest"
3+
ARG BUILD_DATE
4+
ARG VCS_REF
5+
6+
# Stage 1: Get Litestream binary
17
FROM litestream/litestream:0.3 AS builder
28

9+
# Stage 2: Main image based on Linkding
310
FROM sissbruecker/linkding:latest
411

5-
# Install Litestream
12+
# OCI standard labels
13+
# See: https://github.com/opencontainers/image-spec/blob/main/annotations.md
14+
LABEL org.opencontainers.image.title="Linkding with Litestream" \
15+
org.opencontainers.image.description="Self-hosted bookmark manager (Linkding) with automated SQLite backup to S3 using Litestream" \
16+
org.opencontainers.image.url="https://github.com/zhaochunqi/linkding-deployment" \
17+
org.opencontainers.image.source="https://github.com/zhaochunqi/linkding-deployment" \
18+
org.opencontainers.image.version="${VERSION}" \
19+
org.opencontainers.image.created="${BUILD_DATE}" \
20+
org.opencontainers.image.revision="${VCS_REF}" \
21+
org.opencontainers.image.licenses="MIT" \
22+
org.opencontainers.image.vendor="zhaochunqi" \
23+
org.opencontainers.image.authors="zhaochunqi" \
24+
org.opencontainers.image.documentation="https://github.com/zhaochunqi/linkding-deployment/blob/main/README.md"
25+
26+
# Legacy labels for compatibility
27+
LABEL maintainer="zhaochunqi" \
28+
org.label-schema.schema-version="1.0" \
29+
org.label-schema.name="Linkding with Litestream" \
30+
org.label-schema.description="Self-hosted bookmark manager with S3 backup" \
31+
org.label-schema.url="https://github.com/zhaochunqi/linkding-deployment" \
32+
org.label-schema.vcs-url="https://github.com/zhaochunqi/linkding-deployment" \
33+
org.label-schema.version="${VERSION}" \
34+
org.label-schema.build-date="${BUILD_DATE}" \
35+
org.label-schema.vcs-ref="${VCS_REF}"
36+
37+
# Install Litestream binary from builder stage
638
COPY --from=builder /usr/local/bin/litestream /usr/local/bin/litestream
739

8-
# Copy configuration and entrypoint
40+
# Copy Litestream configuration and custom entrypoint
941
COPY litestream.yml /etc/litestream.yml
1042
COPY entrypoint.sh /entrypoint.sh
1143
RUN chmod +x /entrypoint.sh
1244

45+
# Use custom entrypoint that handles database restore and replication
1346
ENTRYPOINT ["/entrypoint.sh"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 zhaochunqi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,35 @@
88
- 💾 自动备份 SQLite 数据库到 S3 兼容存储
99
- 🔄 容器重启时自动从备份恢复数据库
1010

11-
## 快速开始
11+
## 使用预构建镜像
12+
13+
### 可用标签
14+
15+
镜像发布在 GitHub Container Registry,支持以下标签:
16+
17+
- `latest`: 最新版本 (推荐用于生产环境)
18+
- `sha-<commit>`: 特定 commit 版本 (用于版本锁定)
19+
- `YYYYMMDD`: 每日构建版本 (用于追踪特定日期的构建)
20+
21+
### 快速运行
22+
23+
使用预构建镜像,无需本地构建:
24+
25+
```bash
26+
# 1. 配置环境变量
27+
cp .env.example .env
28+
# 编辑 .env 填入你的 S3 凭证
29+
30+
# 2. 直接运行
31+
docker run -d \
32+
--name linkding \
33+
-p 9090:9090 \
34+
--env-file .env \
35+
-v linkding-data:/etc/linkding/data \
36+
ghcr.io/zhaochunqi/linkding:latest
37+
```
38+
39+
## 从源码构建
1240

1341
### 1. 配置环境变量
1442

@@ -24,7 +52,7 @@ cp .env.example .env
2452
LITESTREAM_ACCESS_KEY_ID=your_access_key_id
2553
LITESTREAM_SECRET_ACCESS_KEY=your_secret_access_key
2654
LITESTREAM_S3_BUCKET=your_bucket_name
27-
LITESTREAM_S3_ENDPOINT=https://s3.us-west-002.backblazeb2.com
55+
LITESTREAM_S3_ENDPOINT=https://custom-endpoint
2856
LITESTREAM_S3_PATH=linkding
2957
```
3058

@@ -61,3 +89,12 @@ docker run -d \
6189
- 保留时间: 7 天
6290

6391
可根据需要修改 `litestream.yml` 中的配置。
92+
93+
## 许可证
94+
95+
本项目采用 [MIT License](LICENSE) 开源。
96+
97+
## 致谢
98+
99+
- [Linkding](https://github.com/sissbruecker/linkding) - 优秀的自托管书签管理器
100+
- [Litestream](https://litestream.io/) - SQLite 数据库流式复制工具

0 commit comments

Comments
 (0)