Files
bttoxin-pipeline/docker/dockerfiles/Dockerfile.traefik
zly c75c85c53b Refactor: Unified pipeline execution, simplified UI, and fixed Docker config
- Backend: Refactored tasks.py to directly invoke run_single_fna_pipeline.py for consistency.
- Backend: Changed output format to ZIP and added auto-cleanup of intermediate files.
- Backend: Fixed language parameter passing in API and tasks.
- Frontend: Removed CRISPR Fusion UI elements from Submit and Monitor views.
- Frontend: Implemented simulated progress bar for better UX.
- Frontend: Restored One-click load button and added result file structure documentation.
- Docker: Fixed critical Restarting loop by removing incorrect image directive in docker-compose.yml.
- Docker: Optimized Dockerfile to correct .pixi environment path issues and prevent accidental deletion of frontend assets.
2026-01-20 20:25:25 +08:00

77 lines
2.3 KiB
Docker

# BtToxin Pipeline - Production Dockerfile
# Optimized for Traefik deployment with unified context
# ===========================
# Stage 1: Builder (Environment & Code)
# ===========================
FROM ghcr.io/prefix-dev/pixi:latest AS builder
WORKDIR /app
# Copy entire project context (filtered by .dockerignore)
COPY . .
# Install dependencies
RUN pixi install
# Setup external database for BtToxin_Digger
# Using the copy from tools directory included in COPY . .
RUN DIGGER_PREFIX=$(pixi info --json | grep -A 5 '"name": "digger"' | grep '"prefix":' | cut -d '"' -f 4) && \
mkdir -p $DIGGER_PREFIX/bin/BTTCMP_db/bt_toxin && \
rm -rf $DIGGER_PREFIX/bin/BTTCMP_db/bt_toxin/* && \
cp -r /app/tools/bttoxin_digger/external_dbs/bt_toxin/* $DIGGER_PREFIX/bin/BTTCMP_db/bt_toxin/ && \
echo "Overwrote internal database with version from external_dbs"
# Create shell hook for webbackend environment
RUN pixi shell-hook -e webbackend > /shell-hook.sh && \
echo 'exec "$@"' >> /shell-hook.sh
# ===========================
# Stage 2: Frontend Builder
# ===========================
FROM docker.m.daocloud.io/library/node:20 AS frontend-builder
WORKDIR /app
ENV CI=true
# Copy only frontend source
COPY frontend/ .
RUN npm install -g pnpm && \
pnpm install --no-frozen-lockfile && \
pnpm build
# ===========================
# Stage 3: Production (Runtime)
# ===========================
FROM docker.m.daocloud.io/library/ubuntu:20.04 AS production
WORKDIR /app
# Install runtime dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*
# Copy pixi executable
COPY --from=builder /usr/local/bin/pixi /usr/local/bin/pixi
RUN chmod +x /usr/local/bin/pixi
# Copy entire prepared application directory (Code + Environment + Data)
COPY --from=builder /app /app
# Copy shell hook
COPY --from=builder /shell-hook.sh /shell-hook.sh
# Copy built frontend assets
COPY --from=frontend-builder /app/dist /app/frontend/dist
# Set permissions and cleanup
RUN chmod -R 755 /app/frontend/dist && \
mkdir -p /app/jobs && chmod 777 /app/jobs
EXPOSE 8000
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:8000/health || exit 1
ENTRYPOINT ["/bin/bash", "/shell-hook.sh"]
CMD ["uvicorn", "backend.app.main_spa:app", "--host", "0.0.0.0", "--port", "8000"]