Skip to content

Commit

Permalink
Add Docker setup (#10)
Browse files Browse the repository at this point in the history
* Add Docker setup
  • Loading branch information
freetonik authored Nov 6, 2024
1 parent 30683fe commit c7eeb48
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 1 deletion.
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;
}
}

0 comments on commit c7eeb48

Please sign in to comment.