From fa4d92ee53e2202a2d1c07a9b3e4da5cad21ea26 Mon Sep 17 00:00:00 2001 From: Clemens Wolff Date: Mon, 11 Nov 2019 16:19:25 -0500 Subject: [PATCH] Add volume for SQLite DB in doccano container --- Dockerfile | 6 ++++++ README.md | 23 +++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1b8019ab..db69bde4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,12 +48,18 @@ RUN /doccano/tools/install-mssql.sh RUN useradd -ms /bin/sh doccano +RUN mkdir /data \ + && chown doccano:doccano /data + COPY --from=builder /deps /deps # hadolint ignore=DL3013 RUN pip install --no-cache-dir /deps/*.whl COPY --from=cleaner --chown=doccano:doccano /doccano /doccano +VOLUME /data +ENV DATABASE_URL="sqlite:////data/doccano.db" + ENV DEBUG="True" ENV SECRET_KEY="change-me-in-production" ENV PORT="8000" diff --git a/README.md b/README.md index 463f3230..632ceeb2 100644 --- a/README.md +++ b/README.md @@ -60,15 +60,26 @@ git clone https://github.com/chakki-works/doccano.git --config core.autocrlf=inp ### Docker +As a one-time setup, create a Docker container for Doccano: + +```bash +docker pull chakkiworks/doccano +docker container create --name doccano \ + -e "ADMIN_USERNAME=admin" \ + -e "ADMIN_EMAIL=admin@example.com" \ + -e "ADMIN_PASSWORD=password" \ + -p 8000:8000 chakkiworks/doccano +``` + +Next, start Doccano by running the container: + ```bash -$ docker pull chakkiworks/doccano -$ docker run -d --rm --name doccano \ - -e "ADMIN_USERNAME=admin" \ - -e "ADMIN_EMAIL=admin@example.com" \ - -e "ADMIN_PASSWORD=password" \ - -p 8000:8000 chakkiworks/doccano +docker container start doccano ``` +To stop the container, run `docker container stop doccano -t 5`. +All data created in the container will persist across restarts. + Access . ## One-click Deployment