From a3fa88b037af00e7e5b41d1c872698d7cfcb9aa6 Mon Sep 17 00:00:00 2001 From: morvanzhou Date: Fri, 24 May 2024 07:28:38 +0800 Subject: [PATCH] feat(docker): update --- Dockerfile | 6 +++--- README.md | 6 +++--- README_ZH.md | 17 ++++++++++++++--- src/retk/version_manager/migrate.py | 8 ++++---- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4b5d1d0..4b7b976 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ FROM python:3.11.9-slim-bullseye MAINTAINER morvanzhou@hotmail.com -WORKDIR /app +WORKDIR / -COPY . /app -ENV PYTHONPATH=/app/src +COPY . / +ENV PYTHONPATH=/src RUN python3 -m pip install --no-cache-dir -e . EXPOSE 8080 diff --git a/README.md b/README.md index 9ee4e3f..824a9a1 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -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 ``` @@ -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 ``` diff --git a/README_ZH.md b/README_ZH.md index e408575..de17ed0 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -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` 使用服务。 @@ -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 ``` ### 全部可配置的环境变量: diff --git a/src/retk/version_manager/migrate.py b/src/retk/version_manager/migrate.py index e8402bf..3f02050 100644 --- a/src/retk/version_manager/migrate.py +++ b/src/retk/version_manager/migrate.py @@ -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"] = { @@ -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