Skip to content

Commit

Permalink
Update Dockerfile.blackhole
Browse files Browse the repository at this point in the history
  • Loading branch information
Pukabyte authored Dec 14, 2024
1 parent 7f851d9 commit a799d91
Showing 1 changed file with 33 additions and 9 deletions.
42 changes: 33 additions & 9 deletions Dockerfile.blackhole
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
FROM python:3.9-slim
# Frontend build stage
FROM node:18-slim AS frontend-builder
WORKDIR /app

# Copy package files first for better caching
COPY client/package*.json ./
RUN npm install

# Copy the rest of the client code
COPY client/ ./

# Build the frontend first
RUN npm run build

# Create directory structure for mediainfo images
RUN mkdir -p /app/build/static/images/mediainfo/codec \
/app/build/static/images/mediainfo/edition \
/app/build/static/images/mediainfo/resolution

# Metadata labels
# Copy mediainfo images to the correct location and verify
COPY client/src/images/mediainfo/codec/* /app/build/static/images/mediainfo/codec/
COPY client/src/images/mediainfo/edition/* /app/build/static/images/mediainfo/edition/
COPY client/src/images/mediainfo/resolution/* /app/build/static/images/mediainfo/resolution/

# Python application stage
FROM python:3.9-slim
LABEL org.opencontainers.image.source="https://github.com/westsurname/scripts"
LABEL org.opencontainers.image.description="Docker image for the blackhole service"

ARG SERVICE_NAME=blackhole

# Set working directory
WORKDIR /app

# Copy only the files needed for pip install to maximize cache utilization
# Install Python dependencies first for better caching
COPY requirements.txt ./

# Install Python dependencies
RUN grep -E "#.*($SERVICE_NAME|all)" requirements.txt | awk '{print $0}' > service_requirements.txt && \
pip install --no-cache-dir -r service_requirements.txt

# Copy the rest of the application
# Copy application code
COPY . .

CMD ["python", "blackhole_watcher.py"]
# Copy frontend build files
COPY --from=frontend-builder /app/build/* /app/static/

ENV PYTHONBUFFERED=1

CMD ["python", "blackhole_watcher.py"]

0 comments on commit a799d91

Please sign in to comment.