Refactor Dockerfile to streamline application file copying and remove unnecessary dependencies; add .dockerignore to manage included files.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
# Exclude everything by default
|
||||
*
|
||||
# Then explicitly include only what we need
|
||||
|
||||
# Core application files
|
||||
!musicround/
|
||||
!migrations/
|
||||
!run_migration.py
|
||||
!run.py
|
||||
!requirements.txt
|
||||
!docker-entrypoint.sh
|
||||
!LICENSE
|
||||
!favicon.ico
|
||||
|
||||
# Exclude unnecessary files within included directories
|
||||
**/__pycache__/
|
||||
**/*.pyc
|
||||
**/*.pyo
|
||||
**/*.pyd
|
||||
**/.*
|
||||
musicround/mp3/
|
||||
+6
-5
@@ -4,20 +4,21 @@ FROM python:3.11-slim
|
||||
# Set the working directory to /app
|
||||
WORKDIR /app
|
||||
|
||||
# Install system dependencies and Node.js
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
libavcodec-extra \
|
||||
ffmpeg \
|
||||
curl \
|
||||
gnupg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy requirements first for better caching
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application code
|
||||
COPY . .
|
||||
# Copy only necessary application files
|
||||
# The .dockerignore file ensures we only include what's specified
|
||||
COPY musicround/ ./musicround/
|
||||
COPY migrations/ ./migrations/
|
||||
COPY run_migration.py run.py docker-entrypoint.sh LICENSE favicon.ico ./
|
||||
|
||||
# Make the entrypoint script executable
|
||||
RUN chmod +x docker-entrypoint.sh
|
||||
|
||||
Reference in New Issue
Block a user