Fix: Rename directory to remove & character causing shell issues
Renamed ebook_backend&admin_panel to ebook_backend_admin_panel The & character was being interpreted by shell as background process operator, causing 'Dockerfile not found' errors in Coolify.
This commit is contained in:
70
ebook_backend_admin_panel/Dockerfile
Normal file
70
ebook_backend_admin_panel/Dockerfile
Normal file
@@ -0,0 +1,70 @@
|
||||
# Multi-stage build pre optimalizáciu veľkosti obrazu
|
||||
FROM python:3.11-slim as builder
|
||||
|
||||
# Nastavenie working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Inštalácia build dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
postgresql-client \
|
||||
libpq-dev \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Kopírovanie requirements
|
||||
COPY requirements.txt .
|
||||
|
||||
# Inštalácia Python dependencies do /opt/venv
|
||||
RUN python -m venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
RUN pip install --no-cache-dir --upgrade pip && \
|
||||
pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Production stage
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Nastavenie environment variables
|
||||
ENV PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
# Inštalácia runtime dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
postgresql-client \
|
||||
libpq-dev \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Vytvorenie non-root user pre bezpečnosť
|
||||
RUN useradd -m -u 1000 appuser
|
||||
|
||||
# Nastavenie working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Kopírovanie Python virtual environment z builder stage
|
||||
COPY --from=builder /opt/venv /opt/venv
|
||||
|
||||
# Kopírovanie aplikačných súborov
|
||||
COPY --chown=appuser:appuser . .
|
||||
|
||||
# Vytvorenie potrebných adresárov
|
||||
RUN mkdir -p /app/admin-backend/logs \
|
||||
/app/admin-backend/translationfile \
|
||||
&& chown -R appuser:appuser /app
|
||||
|
||||
# Prepnutie na non-root user
|
||||
USER appuser
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
|
||||
# Healthcheck
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
||||
CMD curl -f http://localhost:8000/health || exit 1
|
||||
|
||||
# Spustenie aplikácie
|
||||
WORKDIR /app/admin-backend
|
||||
|
||||
# Použijeme shell form aby sme mohli spustiť init_db.py a potom uvicorn
|
||||
CMD ["/bin/sh", "-c", "python init_db.py && uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4"]
|
||||
Reference in New Issue
Block a user