Download section didn't appear. Resolved
This commit is contained in:
+12
-21
@@ -1,10 +1,11 @@
|
||||
FROM python:3.13-slim
|
||||
|
||||
# Install FFmpeg and system dependencies
|
||||
# Install FFmpeg, system dependencies, and gosu from APT
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
ffmpeg \
|
||||
ca-certificates \
|
||||
gosu \
|
||||
&& \
|
||||
apt-get clean && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
@@ -16,39 +17,29 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Copy and install Python dependencies
|
||||
# ------------------------------------------------------------
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY web/backend/requirements-web.txt .
|
||||
RUN pip install --no-cache-dir -r requirements-web.txt
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Copy the backend application code
|
||||
# ------------------------------------------------------------
|
||||
# Copy backend code
|
||||
COPY web/backend /app/backend
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Copy and install the audio_splitter package
|
||||
# ------------------------------------------------------------
|
||||
# Copy and install audio_splitter package
|
||||
COPY audio_splitter /app/audio_splitter
|
||||
COPY setup.py pyproject.toml README.md /app/
|
||||
|
||||
# Install audio_splitter as a package
|
||||
RUN pip install --no-cache-dir /app
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Create a non-root user
|
||||
# ------------------------------------------------------------
|
||||
RUN addgroup --system --gid 1000 appgroup && \
|
||||
adduser --system --uid 1000 --ingroup appgroup appuser && \
|
||||
chown -R appuser:appgroup /app
|
||||
|
||||
USER appuser
|
||||
# Copy entrypoint script
|
||||
COPY web/backend/docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Expose port and start
|
||||
# ------------------------------------------------------------
|
||||
# Set entrypoint
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
|
||||
# Expose port
|
||||
EXPOSE 8000
|
||||
|
||||
# PYTHONPATH is already /app by default because we set WORKDIR /app
|
||||
CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Detect if we are running as root (default)
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
# Ensure the temp directory exists and set ownership
|
||||
if [ -d "/tmp/audio_splitter_web" ]; then
|
||||
echo "Setting ownership of /tmp/audio_splitter_web to appuser:appgroup"
|
||||
chown -R appuser:appgroup /tmp/audio_splitter_web
|
||||
else
|
||||
echo "Creating /tmp/audio_splitter_web and setting ownership"
|
||||
mkdir -p /tmp/audio_splitter_web
|
||||
chown -R appuser:appgroup /tmp/audio_splitter_web
|
||||
fi
|
||||
|
||||
# Drop privileges and run uvicorn using gosu
|
||||
exec gosu appuser uvicorn backend.main:app --host 0.0.0.0 --port 8000
|
||||
else
|
||||
# If not root, just run directly
|
||||
exec uvicorn backend.main:app --host 0.0.0.0 --port 8000
|
||||
fi
|
||||
Reference in New Issue
Block a user