13 Commits

Author SHA1 Message Date
5c2b300c28 Update docker-compose.yml 2025-06-03 08:43:23 +02:00
6f8216cd37 try to get docker working 2025-06-03 08:29:18 +02:00
07e224ccbf Update docker-compose.yml 2025-06-03 08:24:05 +02:00
e6ba4f3d8a Update Dockerfile 2025-06-03 08:21:53 +02:00
33844ddd3e Update Dockerfile 2025-06-03 07:28:18 +02:00
583710763e Update docker-compose.yml 2025-06-03 07:23:46 +02:00
6708d4afaf Update docker-compose.yml 2025-06-03 07:21:45 +02:00
24fbc74c87 Update docker-compose.yml 2025-06-03 07:20:12 +02:00
0f4b21818b Update Dockerfile 2025-06-02 22:12:03 +02:00
6b0012c423 try to fix portainer issue 2025-06-02 21:55:38 +02:00
44fd8433a1 fix start 2025-06-02 21:50:53 +02:00
b493446048 fix preferred view 2025-06-02 21:37:03 +02:00
b72acbf912 fix docker data permissions 2025-06-02 21:30:07 +02:00
7 changed files with 41 additions and 44 deletions

16
.dockerignore Normal file
View File

@@ -0,0 +1,16 @@
# Exclude everything
*
# Include specific files and directories
!start.sh
!requirements.txt
!app.py
!celery_worker.py
!models.py
!extensions.py
!utils/
!routes/
!templates/
!static/
!migrations/
!uploads/

View File

@@ -5,6 +5,7 @@ RUN apt-get update && apt-get install -y \
build-essential \
libpq-dev \
curl \
wget \
netcat-traditional \
&& rm -rf /var/lib/apt/lists/*
@@ -14,42 +15,22 @@ RUN useradd -m -u 1000 celery
# Set working directory
WORKDIR /app
# Copy requirements first to leverage Docker cache
COPY requirements.txt .
# Copy the entire application
COPY . /app/
# Set up start.sh
RUN chmod +x /app/start.sh && \
chown celery:celery /app/start.sh
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories and set permissions
RUN mkdir -p /app/uploads /app/static/uploads && \
RUN mkdir -p /data/rooms && \
chown -R celery:celery /data && \
chmod -R 755 /data && \
chown -R celery:celery /app
# Create and set up startup script
RUN echo '#!/bin/bash\n\
echo "Waiting for database..."\n\
while ! nc -z db 5432; do\n\
sleep 0.1\n\
done\n\
echo "Database is ready!"\n\
\n\
echo "Waiting for Redis..."\n\
while ! nc -z redis 6379; do\n\
sleep 0.1\n\
done\n\
echo "Redis is ready!"\n\
\n\
echo "Running database migrations..."\n\
flask db upgrade\n\
\n\
echo "Creating admin user..."\n\
flask create-admin\n\
\n\
echo "Starting application..."\n\
exec "$@"' > /app/start.sh && \
chmod +x /app/start.sh && \
chown celery:celery /app/start.sh
# Switch to non-root user
USER celery

Binary file not shown.

2
app.py
View File

@@ -6,7 +6,6 @@ import os
from models import User, SiteSettings
from flask_wtf.csrf import generate_csrf
from routes.room_files import room_files_bp
from routes.user import user_bp
from routes.room_members import room_members_bp
from routes.trash import trash_bp
from tasks import cleanup_trash
@@ -80,7 +79,6 @@ def create_app():
from routes import init_app
init_app(app)
app.register_blueprint(room_files_bp, url_prefix='/api/rooms')
app.register_blueprint(user_bp, url_prefix='/api/users')
app.register_blueprint(room_members_bp, url_prefix='/api/rooms')
app.register_blueprint(trash_bp, url_prefix='/api/trash')

View File

@@ -1,5 +1,3 @@
version: '3.8'
services:
web:
build: .
@@ -15,13 +13,15 @@ services:
- POSTGRES_DB=docupulse
- REDIS_URL=redis://redis:6379/0
volumes:
- uploads:/app/uploads
- uploads:/data
depends_on:
- db
- redis
db:
condition: service_healthy
redis:
condition: service_healthy
restart: unless-stopped
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/health"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5000/health"]
interval: 30s
timeout: 10s
retries: 3
@@ -49,7 +49,7 @@ services:
redis:
image: redis:7
ports:
- "6379:6379"
- "26379:6379"
restart: unless-stopped
healthcheck:
test: ["CMD", "redis-cli", "ping"]
@@ -58,7 +58,9 @@ services:
retries: 3
celery_worker:
build: .
build:
context: https://git.kobeamerijckx.com/Kobe/docupulse.git
dockerfile: Dockerfile
command: celery -A celery_worker.celery worker --loglevel=info
volumes:
- .:/app
@@ -86,6 +88,4 @@ services:
volumes:
postgres_data:
name: ${COMPOSE_PROJECT_NAME:-default}_postgres_data
uploads:
name: ${COMPOSE_PROJECT_NAME:-default}_uploads
uploads:

View File

@@ -16,6 +16,7 @@ def init_app(app: Flask):
from .conversations import conversations_bp as conversations_routes
from .admin import admin as admin_routes
from .email_templates import email_templates as email_templates_routes
from .user import user_bp as user_routes
# Initialize routes
init_main_routes(main_bp)
@@ -35,6 +36,7 @@ def init_app(app: Flask):
app.register_blueprint(conversations_routes)
app.register_blueprint(admin_routes)
app.register_blueprint(email_templates_routes)
app.register_blueprint(user_routes)
@app.route('/rooms/<int:room_id>/trash')
@login_required