1- # Use alpine base image
2- FROM python:alpine
1+ # -----------------------------------------------------------------------------
2+ # Stage 1: UI Build
3+ # -----------------------------------------------------------------------------
4+ FROM node:18-alpine AS ui-builder
35
4- # Labels for metadata
5- LABEL maintainer="CoderLuii"
6- LABEL version="0.5"
7- LABEL description="ChannelWatch - Channels DVR Monitoring Tool"
6+ WORKDIR /src
7+ COPY ui/ .
88
9- # Set working directory
10- WORKDIR /app
9+ RUN npm install -g pnpm
10+ RUN pnpm install
11+ RUN pnpm build
1112
12- # Copy requirements file
13- COPY requirements.txt .
13+ # -----------------------------------------------------------------------------
14+ # Stage 2: Application
15+ # -----------------------------------------------------------------------------
16+ FROM python:alpine
1417
15- # Install required Python packages
16- RUN pip install --no-cache-dir -r requirements.txt
18+ # System setup
19+ ARG UID=1000
20+ ARG GID=1000
21+ RUN addgroup -g ${GID} -S appgroup \
22+ && adduser -u ${UID} -S appuser -G appgroup
1723
18- # Copy the application code
19- COPY . /app/channelwatch
24+ # Metadata
25+ LABEL maintainer="CoderLuii"
26+ LABEL version="0.7"
27+ LABEL description="ChannelWatch - Channels DVR Monitoring Tool"
2028
21- # Create configuration directory
22- RUN mkdir -p /config
29+ # Directory structure
30+ RUN mkdir -p /app/core \
31+ /app/ui/static_ui \
32+ /config \
33+ /etc/supervisor/conf.d/
2334
24- # Make main.py executable
25- RUN chmod +x /app/channelwatch/main.py
35+ WORKDIR /app
2636
27- # Default command
28- CMD ["python" , "-m" , "channelwatch.main" , "--stay-alive" ]
37+ # Dependencies
38+ COPY requirements.txt .
39+ RUN apk add --no-cache build-base libffi-dev tzdata grep sed su-exec \
40+ && pip install --no-cache-dir -r requirements.txt \
41+ && apk del build-base libffi-dev
42+
43+ # Application files
44+ COPY core/ /app/core/
45+ COPY ui/backend/config.py ui/backend/main.py ui/backend/schemas.py /app/ui/
46+ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
47+ COPY --from=ui-builder /src/out /app/ui/static_ui/
48+ COPY ui/public/images /app/ui/static/images/
49+
50+ # Permissions
51+ RUN chmod +x /app/core/docker-entrypoint.sh
52+ RUN chown -R appuser:appgroup /app /config
53+
54+ # Runtime
55+ EXPOSE 8501
56+ ENTRYPOINT ["/bin/sh" , "/app/core/docker-entrypoint.sh" ]
57+ CMD ["/usr/local/bin/supervisord" , "-c" , "/etc/supervisor/conf.d/supervisord.conf" ]
0 commit comments