-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |