Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker setup #10

Merged
merged 2 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
23 changes: 23 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 <<EOF /app/start.sh
#!/bin/bash
service nginx start
cd notes
textpod -p 3000
EOF

RUN chmod +x /app/start.sh

CMD ["/app/start.sh"]
9 changes: 9 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
services:
textpod-docker:
image: textpod-docker
build: .
ports:
- '8099:80'
volumes:
- './notes:/app/notes'
container_name: textpod
9 changes: 9 additions & 0 deletions docker/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {
listen 80;
listen [::]:80;

location / {
proxy_pass http://127.0.0.1:3000;
include /etc/nginx/proxy_params;
}
}