Dispatcharr/docker/Dockerfile
2025-05-08 10:56:05 -05:00

38 lines
No EOL
1.2 KiB
Docker

# Base image with Python, Redis, PostgreSQL, FFmpeg, Nginx
FROM sergeantpanda/dispatcharr:base AS base
# --- Build frontend ---
FROM node:20 AS frontend-builder
WORKDIR /app/frontend
COPY ./frontend /app/frontend
RUN corepack enable && corepack prepare yarn@stable --activate && \
yarn install && yarn build && \
rm -rf node_modules .cache
# --- Final image based on the base ---
FROM sergeantpanda/dispatcharr:base AS final
ENV VIRTUAL_ENV=/dispatcharrpy
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
WORKDIR /app
# Copy application code
COPY . /app
# Copy nginx configuration
COPY ./docker/nginx.conf /etc/nginx/sites-enabled/default
# Copy built frontend assets
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist
# Run Django collectstatic
RUN python manage.py collectstatic --noinput
# Add timestamp argument
ARG TIMESTAMP
# Update version.py with build timestamp if provided
RUN if [ -n "$TIMESTAMP" ]; then \
echo "Updating timestamp to ${TIMESTAMP} in version.py" && \
sed -i "s|__timestamp__ = None.*|__timestamp__ = '${TIMESTAMP}' # Set during CI/CD build process|" /app/version.py && \
cat /app/version.py; \
fi
CMD ["/app/docker/entrypoint.sh"]