Merge pull request 'Add Docker Compose file' (#3) from theycallhermax/catask:main into main

Reviewed-on: https://codeberg.org/catask-org/catask/pulls/3
This commit is contained in:
mystieneko 2025-03-02 08:41:34 +00:00
commit 94afd8b4f3
5 changed files with 88 additions and 3 deletions

7
Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM python:3-alpine
WORKDIR /catask
COPY . .
RUN pip install --no-cache-dir -r requirements.txt
ENTRYPOINT [ "gunicorn", "-w", "4", "app:app", "--bind", "0.0.0.0:8000" ]

View file

@ -11,8 +11,8 @@ a simple & easy to use Q&A software that makes answering questions easier
## Install ## Install
Clone this repository: `git clone https://git.gay/mst/catask.git` Clone this repository: `git clone https://git.gay/mst/catask.git`
<!--### Docker ### Docker
See [docker.md](https://git.gay/mst/catask/src/branch/main/docker.md)--> See [docker.md](https://git.gay/mst/catask/src/branch/main/docker.md)
### VPS-specific ### VPS-specific
Go into the cloned repository, create a virtual environment and activate it: Go into the cloned repository, create a virtual environment and activate it:

45
docker-compose.yml Normal file
View file

@ -0,0 +1,45 @@
name: catask
services:
postgres:
environment:
POSTGRES_DB: catask
POSTGRES_USER: catask
POSTGRES_PASSWORD: catask
healthcheck:
test: ["CMD", "pg_isready", "-U", "catask"]
interval: 1s
timeout: 5s
retries: 10
image: postgres:alpine
networks:
- catask
restart: always
volumes:
- ./schema.sql:/docker-entrypoint-initdb.d/catask.sql
- db-data:/var/lib/postgresql/data
catask:
build:
dockerfile: Dockerfile
depends_on:
postgres:
condition: service_healthy
networks:
- catask
ports:
- "8000:8000"
restart: always
volumes:
- catask-data:/catask/static/emojis
- catask-data:/catask/static/icons/favicon
- ./config.json:/catask/config.json
- ./.env:/catask/.env
networks:
catask:
driver: bridge
volumes:
db-data:
catask-data:

33
docker.md Normal file
View file

@ -0,0 +1,33 @@
# CatAsk on Docker (or Podman)
## Prerequisites
- Docker + `docker-compose` (or Podman + `podman-compose`)
## Steps
Before starting CatAsk, you must copy the configuration files to their proper places first:
```sh
cp config.example.json config.json
cp .env.example .env
```
Then, paste this into the `.env` file, and replace sections that are marked with `[CHANGE THIS]`.
```env
DB_HOST = postgres
DB_NAME = catask
DB_USER = catask
DB_PASS = catask
DB_PORT = 5432
ADMIN_PASSWORD = [CHANGE THIS]
APP_SECRET = [CHANGE THIS]
```
You may now start CatAsk:
```sh
docker compose up
```
If you have done everything correctly, going to `http://localhost:8000` in your browser should show a question box screen. You may now log in with your admin password, and configure the instance.

View file

@ -1,6 +1,6 @@
flask flask
python-dotenv python-dotenv
psycopg psycopg[binary,pool]
humanize humanize
mistune mistune
bleach bleach