Skip to content
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
61 changes: 61 additions & 0 deletions .github/workflows/build-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build and Push Docker Image

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Install Docker Compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.26.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

- name: Prepare QEMU Environment
uses: docker/setup-qemu-action@v1

- name: Configure Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Authenticate Docker Hub
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get version from app/params.json file
id: get_version
run: |
VERSION=$(jq -r '.VERSION' < app/params.json)
echo "version=$VERSION" >> $GITHUB_ENV

- name: Build and Push Image to Docker Hub
env:
FLASK_RUN_HOST: "0.0.0.0"
FLASK_RUN_PORT: "8080"
SECRET_KEY: "none"
GOOGLE_GEMINI_API_KEY: "none"
ENABLE_GEMINI_API: "false"
GEMINI_MODEL: "gemini-2.0-flash"
run: |
docker-compose -f docker-compose.yaml config > docker-stack.yml
docker buildx create --use
docker buildx build --push --platform linux/amd64,linux/arm64 \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/bookworm:latest \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/bookworm:stable \
--tag ${{ secrets.DOCKERHUB_USERNAME }}/bookworm:${{ env.version }} \
--file Dockerfile .

# - name: Clean Up Environment
# run: docker-compose down
25 changes: 25 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use the official Python image from the Docker Hub
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /app

# Copy the requirements file into the container
COPY requirements.txt .

# Install the dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code into the container (app -> /app/app, run.py -> /app)
COPY app /app/app
COPY run.py /app/

# Set environment variables
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=8080

# Expose the port the app runs on
EXPOSE 8080

# Run the application
CMD ["python", "run.py"]
7 changes: 6 additions & 1 deletion app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,9 @@ def api_chat_status():
'initialized': gemini_ai.initialized,
'available': gemini_ai.is_available(),
'model': gemini_ai.model
})
})

@main_bp.route('/healthcheck', methods=['GET'])
def healthcheck():
"""Health check endpoint for the application"""
return jsonify({'status': 'ok'}), 200
Binary file added app/static/images/Logo.ico
Binary file not shown.
Binary file added app/static/images/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>{% block title %}BookWorm{% endblock %}</title>

<!-- Favicon -->
<link rel="icon" href="{{ url_for('static', filename='favicon.ico') }}" type="image/x-icon">
<link rel="icon" href="{{ url_for('static', filename='../static/images/Logo.ico') }}" type="image/x-icon">

<!-- Shadcn styles (mimicking Shadcn look with Tailwind) -->
<script src="{{ url_for('static', filename='js/tailwind.js') }}"></script>
Expand Down Expand Up @@ -107,6 +107,9 @@
90% { transform: translate(1px, 2px) rotate(0deg); }
100% { transform: translate(1px, -2px) rotate(-1deg); }
}
main {
margin-top: 88px; /* or however tall your navbar is */
}
</style>

{% block head %}{% endblock %}
Expand All @@ -119,7 +122,7 @@
<!-- Left side - Logo and article info -->
<div class="flex items-center space-x-4">
<a href="/" class="flex items-center text-xl font-bold text-primary-700 dark:text-primary-300">
<img src="{{ url_for('static', filename='images/banner.png') }}" alt="BookWorm Logo" class="m-0" style="object-fit: fill; height: 24px;">
<img src="{{ url_for('static', filename='images/Logo.png') }}" alt="BookWorm Logo" class="m-0" style="height: 40px; max-height: 100%;">
</a>

<!-- Title and original source - only shown on reader page -->
Expand Down
43 changes: 43 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: '3.8'

services:
web:
container_name: bookworm_web
image: mwcurtis20/bookworm:stable
build: .
ports:
- "8080:${FLASK_RUN_PORT}"
environment:
- FLASK_RUN_HOST=${FLASK_RUN_HOST}
- FLASK_RUN_PORT=${FLASK_RUN_PORT}
- SECRET_KEY=${SECRET_KEY}
- GOOGLE_GEMINI_API_KEY=${GOOGLE_GEMINI_API_KEY}
- ENABLE_GEMINI_API=${ENABLE_GEMINI_API}
- GEMINI_MODEL=${GEMINI_MODEL}
labels:
- "com.centurylinklabs.watchtower.scope=bookworm"
networks:
- internal_bookworm_net
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/healthcheck"]
interval: 30s
timeout: 10s
retries: 3
watchtower:
image: containrrr/watchtower
container_name: bookworm_watchtower
environment:
- REPO_USER=${REPO_USER}
- REPO_PASS=${REPO_PASS}
volumes:
- /var/run/docker.sock:/var/run/docker.sock
labels:
- "com.centurylinklabs.watchtower.scope=bookworm"
networks:
- internal_bookworm_net
command: --debug --scope bookworm --cleanup --interval 300
restart: unless-stopped
networks:
internal_bookworm_net:
external: false
Loading