From c7eeb482f6dba0d7a678720d89a0c4ddf55dae9c Mon Sep 17 00:00:00 2001 From: Rakhim Davletkaliyev Date: Wed, 6 Nov 2024 19:22:02 +0200 Subject: [PATCH] Add Docker setup (#10) * Add Docker setup --- README.md | 17 ++++++++++++++++- docker/Dockerfile | 23 +++++++++++++++++++++++ docker/docker-compose.yml | 9 +++++++++ docker/nginx.conf | 9 +++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 docker/Dockerfile create mode 100644 docker/docker-compose.yml create mode 100644 docker/nginx.conf diff --git a/README.md b/README.md index df43b85..2940075 100644 --- a/README.md +++ b/README.md @@ -31,12 +31,27 @@ brew install textpod In order to download webpages, you need to have `monolith` installed. `cargo install monolith` or `brew install monolith` (macOS). See [monolith](https://github.com/Y2Z/monolith) for more details. - ## Usage Run `textpod` in any directory. It will create a `notes.md` file if it doesn't exist. It will create `attachments` directory for file and image attachments. Webpages are saved in `attachments/webpages`. You can specify the port with `-p` flag, e.g. `textpod -p 8080` and/or the address with `-l` flag, e.g. `textpod -l 0.0.0.0`. +## Docker + +Here's how to build a Docker image and run it on port `8099`, mapping the `notes` directory (under current directory). + +```console +cd docker +docker build -t textpod-docker . +docker run --rm --name textpod -d -v $(pwd)/notes:/app -p 8099:80 textpod-docker +``` + +Or with Compose: + +```console +docker compose up -d --build +``` + ## Contributing Feel free to open issues and pull requests. I want to keep the code very simple and accessible to beginners. The goal is not to create another feature-rich notetaking app, but to keep it simple and fast. diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..3284818 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,23 @@ +FROM rust:latest + +RUN cargo install monolith +RUN cargo install textpod + +RUN mkdir /app +RUN mkdir /app/notes +WORKDIR /app + +RUN apt update +RUN apt install nginx -y +COPY ./nginx.conf /etc/nginx/sites-enabled/default + +COPY <