backlog-md/Dockerfile.aggregator

44 lines
1.2 KiB
Docker

# Backlog Aggregator Dockerfile with Gitea Scanner
# Multi-project real-time task aggregation server
FROM oven/bun:1 AS base
WORKDIR /app
# Install dependencies including git and cron for Gitea scanning
RUN apt-get update && apt-get install -y git cron openssh-client && rm -rf /var/lib/apt/lists/*
# Install npm dependencies
FROM base AS install
RUN mkdir -p /temp/dev
COPY package.json bun.lock* bunfig.toml /temp/dev/
RUN cd /temp/dev && bun install --frozen-lockfile --ignore-scripts
# Build stage
FROM base AS release
COPY --from=install /temp/dev/node_modules node_modules
COPY . .
# Build CSS (needed for components)
RUN bun run build:css || true
# Make entrypoint executable
RUN chmod +x /app/entrypoint.sh || true
# Create cron job for daily Gitea sync (runs at 2 AM and 2 PM)
RUN echo "0 2,14 * * * cd /app && bun run src/aggregator/gitea-scanner.ts --verbose >> /var/log/gitea-scanner.log 2>&1" > /etc/cron.d/gitea-scanner \
&& chmod 0644 /etc/cron.d/gitea-scanner \
&& crontab /etc/cron.d/gitea-scanner
# Create log file
RUN touch /var/log/gitea-scanner.log
# Expose port
EXPOSE 6420
# Set environment
ENV NODE_ENV=production
ENV PORT=6420
# Use entrypoint script
ENTRYPOINT ["/app/entrypoint.sh"]