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
|
# Set the working directory to /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Install system dependencies and Node.js
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
libavcodec-extra \
|
libavcodec-extra \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
curl \
|
|
||||||
gnupg \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Copy requirements first for better caching
|
# Copy requirements first for better caching
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
# Copy application code
|
# Copy only necessary application files
|
||||||
COPY . .
|
# 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
|
# Make the entrypoint script executable
|
||||||
RUN chmod +x docker-entrypoint.sh
|
RUN chmod +x docker-entrypoint.sh
|
||||||
|
|||||||
Reference in New Issue
Block a user