start.sh removed
This commit is contained in:
34
Dockerfile
34
Dockerfile
@@ -6,7 +6,6 @@ RUN apt-get update && apt-get install -y \
|
|||||||
libpq-dev \
|
libpq-dev \
|
||||||
curl \
|
curl \
|
||||||
netcat-traditional \
|
netcat-traditional \
|
||||||
dos2unix \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Create a non-root user
|
# Create a non-root user
|
||||||
@@ -15,11 +14,6 @@ RUN useradd -m -u 1000 celery
|
|||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy start.sh first and set permissions
|
|
||||||
COPY start.sh .
|
|
||||||
RUN dos2unix start.sh && \
|
|
||||||
chmod +x start.sh
|
|
||||||
|
|
||||||
# Copy requirements first to leverage Docker cache
|
# Copy requirements first to leverage Docker cache
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
@@ -31,8 +25,32 @@ COPY . .
|
|||||||
RUN mkdir -p /app/uploads /app/static/uploads && \
|
RUN mkdir -p /app/uploads /app/static/uploads && \
|
||||||
chown -R celery:celery /app
|
chown -R celery:celery /app
|
||||||
|
|
||||||
|
# Create startup script
|
||||||
|
RUN echo '#!/bin/sh\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/entrypoint.sh && \
|
||||||
|
chmod +x /app/entrypoint.sh
|
||||||
|
|
||||||
# Switch to non-root user
|
# Switch to non-root user
|
||||||
USER celery
|
USER celery
|
||||||
|
|
||||||
# Set entrypoint using shell form
|
# Set entrypoint
|
||||||
ENTRYPOINT ./start.sh
|
ENTRYPOINT ["/bin/sh", "/app/entrypoint.sh"]
|
||||||
25
start.sh
25
start.sh
@@ -1,25 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "Starting DocuPulse..."
|
|
||||||
|
|
||||||
echo "Waiting for database..."
|
|
||||||
while ! nc -z db 5432; do
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
echo "Database is ready!"
|
|
||||||
|
|
||||||
echo "Waiting for Redis..."
|
|
||||||
while ! nc -z redis 6379; do
|
|
||||||
sleep 0.1
|
|
||||||
done
|
|
||||||
echo "Redis is ready!"
|
|
||||||
|
|
||||||
echo "Running database migrations..."
|
|
||||||
flask db upgrade
|
|
||||||
|
|
||||||
echo "Creating admin user..."
|
|
||||||
flask create-admin
|
|
||||||
|
|
||||||
echo "Starting application..."
|
|
||||||
exec "$@"
|
|
||||||
Reference in New Issue
Block a user