Skip to content

Commit

Permalink
feat(docker): update
Browse files Browse the repository at this point in the history
  • Loading branch information
MorvanZhou committed May 23, 2024
1 parent eee17c5 commit a3fa88b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM python:3.11.9-slim-bullseye
MAINTAINER [email protected]

WORKDIR /app
WORKDIR /

COPY . /app
ENV PYTHONPATH=/app/src
COPY . /
ENV PYTHONPATH=/src
RUN python3 -m pip install --no-cache-dir -e .

EXPOSE 8080
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ For keeping your data safe, you should mount a local path to the container.
```shell
docker run \
-p 8080:8080 \
-v /your/data/path:/app/.data \
-v /your/data/path:/.data \
morvanzhou/rethink
```

Expand All @@ -76,7 +76,7 @@ and make sure the port is the same as the host's port (`8001` in this example):
docker run \
-e API_URL=http://127.0.0.1:8001 \
-p 8001:8080 \
-v /your/data/path:/app/.data \
-v /your/data/path:/.data \
morvanzhou/rethink
```

Expand All @@ -86,7 +86,7 @@ If you want to set a password for authorization, just add a environment variable
docker run \
-e APP_PASSWORD=12345678 \
-p 8080:8080 \
-v /your/data/path:/app/.data \
-v /your/data/path:/.data \
morvanzhou/rethink
```

Expand Down
17 changes: 14 additions & 3 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ docker pull morvanzhou/rethink
为了保证数据安全,您应该将本地路径挂载到容器中。

```shell
docker run -p 8080:8080 -v /your/data/path:/app/.data morvanzhou/rethink
docker run \
-p 8080:8080 \
-v /your/data/path:/.data \
morvanzhou/rethink
```

现在你可以在浏览器中访问 `http://127.0.0.1:8080` 使用服务。
Expand All @@ -65,13 +68,21 @@ docker run -p 8080:8080 -v /your/data/path:/app/.data morvanzhou/rethink
请确保 `API_URL` 里的端口号和 `-p` 参数的前半部分一致 (在下面案例中的 `8001` 端口)。

```shell
docker run -e API_URL=http://127.0.0.1:8081 -p 8081:8080 -v /your/data/path:/app/.data morvanzhou/rethink
docker run \
-e API_URL=http://127.0.0.1:8081 \
-p 8081:8080 \
-v /your/data/path:/.data \
morvanzhou/rethink
```

如果你想做为 Rethink 鉴权,你可以添加环境变量 `APP_PASSWORD`

```shell
docker run -e APP_PASSWORD=12345678 -p 8080:8080 -v /your/data/path:/app/.data morvanzhou/rethink
docker run \
-e APP_PASSWORD=12345678 \
-p 8080:8080 \
-v /your/data/path:/.data \
morvanzhou/rethink
```

### 全部可配置的环境变量:
Expand Down
8 changes: 4 additions & 4 deletions src/retk/version_manager/migrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ def __version_less_than(dot_rethink: Dict, version) -> bool:
return version_tuple(dot_version) < version_tuple(version)


def __migrate_older_to_0_2_8(dot_rethink: Dict, data_path: Path):
def __migrate_older_to_0_2_9(dot_rethink: Dict, data_path: Path):
"""Migrate the database to version 0.2.8.
Args:
data_path (str): the path to the database folder.
"""
v = "0.2.8"
v = "0.2.9"
dot_rethink["version"] = v
if "settings" not in dot_rethink:
dot_rethink["settings"] = {
Expand Down Expand Up @@ -84,6 +84,6 @@ def to_latest_version(data_path: Union[str, Path] = "."):
logger.debug(".rethink.json is not found. The database is empty.")
return

if __version_less_than(dot_rethink, version="0.2.8"):
__migrate_older_to_0_2_8(dot_rethink, data_path)
if __version_less_than(dot_rethink, version="0.2.9"):
__migrate_older_to_0_2_9(dot_rethink, data_path)
return

0 comments on commit a3fa88b

Please sign in to comment.