Skip to content

Commit

Permalink
ci: use linuxserver base image for docker
Browse files Browse the repository at this point in the history
  • Loading branch information
oae committed Oct 22, 2022
1 parent 95bb65a commit 2eb32f0
Show file tree
Hide file tree
Showing 25 changed files with 302 additions and 128 deletions.
11 changes: 9 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ README.md
certs/
docs/
notes/

docker/Dockerfile*
# pass env vars through docker-compose
# or mount .env* in dev
.env*
Expand All @@ -29,4 +29,11 @@ node_modules/
tests-e2e/node_modules/

# jest coverage
coverage/
coverage/

.git
.gitignore
.github
.gitattributes
READMETEMPLATE.md
README.md
6 changes: 3 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Application
APP_PORT=3000
KAIZOKU_PORT=3000

# Database
DATABASE_USER=kaizoku
Expand All @@ -14,6 +14,6 @@ REDIS_HOST=localhost
REDIS_PORT=6379

# Notification
TELEGRAM_TOKEN="***REMOVED***"
TELEGRAM_CHAT_ID="***REMOVED***"
TELEGRAM_TOKEN=
TELEGRAM_CHAT_ID=
TELEGRAM_SEND_SILENTLY=0
51 changes: 51 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
on:
push:
branches:
- main
name: release-please
jobs:
release-please:
runs-on: ubuntu-latest
steps:
- name: Release
uses: google-github-actions/release-please-action@v3
id: release
with:
command: manifest

- name: Checkout
uses: actions/checkout@v3
if: ${{ steps.release.outputs.release_created }}

- name: Set up Docker Build
id: buildx
uses: docker/setup-buildx-action@v2
if: ${{ steps.release.outputs.release_created }}

- name: Login to Github Packages
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}

- name: Login to Docker hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: ${{ steps.release.outputs.release_created }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: docker/Dockerfile
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/kaizoku:latest
${{ secrets.DOCKERHUB_USERNAME }}/kaizoku:v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:v${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
if: ${{ steps.release.outputs.release_created }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.0.0"
}
72 changes: 0 additions & 72 deletions Dockerfile

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Alperen Elhan

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
97 changes: 77 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,91 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
# <img width="32px" src="./public/kaizoku.png" alt="Kaizoku"></img> Kaizoku

## Getting Started
Kaizoku is self-hosted manga downloader.

First, run the development server:
![Home Page](https://i.imgur.com/KT9LrtX.png)

```bash
npm run dev
# or
yarn dev
```
| Detail Page | Search |
| :---------------------------------------------: | :----------------------------------------: |
| ![Detail Page](https://i.imgur.com/uWgZ9KA.png) | ![Search](https://i.imgur.com/XP4coVD.png) |

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
## Deployment

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.
You can deploy Kaizoku with following docker-compose file

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.
```yaml
version: '3'

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
volumes:
db:
redis:

services:
app:
container_name: kaizoku
image: <tbd>
environment:
- DATABASE_URL=postgresql://kaizoku:kaizoku@db:5432/kaizoku
- KAIZOKU_PORT=3000
- REDIS_HOST=redis
- REDIS_HOST=6379
- TELEGRAM_TOKEN=<token> # Don't set if you don't want telegram notifications.
- TELEGRAM_CHAT_ID=<chat_id>
- TELEGRAM_SEND_SILENTLY=0
- PUID=<host user puid>
- PGID=<host user guid>
- TZ=Europe/Istanbul
volumes:
- <path_to_library>:/data
- <path_to_config>:/config
- <path_to_logs>:/logs
depends_on:
db:
condition: service_healthy
ports:
- '3000:3000'
redis:
image: redis:7-alpine
volumes:
- redis:/data
db:
image: postgres:alpine
restart: unless-stopped
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U kaizoku']
interval: 5s
timeout: 5s
retries: 5
environment:
- POSTGRES_USER=kaizoku
- POSTGRES_DB=kaizoku
- POSTGRES_PASSWORD=kaizoku
volumes:
- db:/var/lib/postgresql/data
```
## Learn More
## Development
To learn more about Next.js, take a look at the following resources:
### Requirements
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- node 18
- yarn
- docker
- [mangal](https://github.com/metafates/mangal)
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
### Start the Kaizoku
```bash
git clone https://github.com/oae/kaizoku.git
cd ./kaizoku/
cp .env.example .env
yarn install
docker compose up -d redis db
yarn run prisma migrate deploy
yarn dev:server
```

## Deploy on Vercel
Open [http://localhost:3000](http://localhost:3000) with your browser to see the page.

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
## Credits

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
Kaizoku uses amazing [mangal](https://github.com/metafates/mangal) by [@metafates](https://github.com/metafates) as it's downloader.
27 changes: 17 additions & 10 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,30 @@ volumes:
services:
app:
container_name: kaizoku
build: .
build:
context: .
dockerfile: docker/Dockerfile
environment:
DATABASE_URL: postgresql://${DATABASE_USER}:${DATABASE_PASSWORD}@db:${DATABASE_PORT}/${DATABASE_SCHEMA}
REDIS_HOST: redis
- DATABASE_URL=postgresql://${DATABASE_USER:-kaizoku}:${DATABASE_PASSWORD:-kaizoku}@db:${DATABASE_PORT:-5432}/${DATABASE_SCHEMA:-kaizoku}
- REDIS_HOST=redis
- PUID=1000
- PGID=1000
- TZ=Europe/Istanbul
env_file:
- .env
volumes:
- /home/alperen/Manga:/data/manga
- ./kaizoku/data:/data
- ./kaizoku/config:/config
- ./kaizoku/logs:/logs
depends_on:
db:
condition: service_healthy
ports:
- "${APP_PORT}:3000"
- "${KAIZOKU_PORT:-3000}:3000"
redis:
image: redis:7-alpine
ports:
- "${REDIS_PORT}:6379"
- "${REDIS_PORT:-6379}:6379"
db:
image: postgres:alpine
restart: unless-stopped
Expand All @@ -35,10 +42,10 @@ services:
env_file:
- .env
environment:
POSTGRES_USER: ${DATABASE_USER}
POSTGRES_DB: ${DATABASE_SCHEMA}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
- POSTGRES_USER=${DATABASE_USER:-kaizoku}
- POSTGRES_DB=${DATABASE_SCHEMA:-kaizoku}
- POSTGRES_PASSWORD=${DATABASE_PASSWORD:-kaizoku}
volumes:
- db:/var/lib/postgresql/data
ports:
- "${DATABASE_PORT}:5432"
- "${DATABASE_PORT:-5432}:5432"
Loading

0 comments on commit 2eb32f0

Please sign in to comment.