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.
This commit is contained in:
@@ -1,118 +0,0 @@
|
||||
# Build stage: Install dependencies using pixi
|
||||
FROM ghcr.io/prefix-dev/pixi:latest AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy project files
|
||||
COPY pixi.toml .
|
||||
COPY pyproject.toml .
|
||||
COPY scripts/ scripts/
|
||||
COPY bttoxin/ bttoxin/
|
||||
COPY web/ web/
|
||||
COPY Data/ Data/
|
||||
COPY frontend/ frontend/
|
||||
|
||||
# Install all pixi environments
|
||||
RUN pixi install
|
||||
|
||||
# Create shell hook for webbackend environment
|
||||
RUN pixi shell-hook -e webbackend > /shell-hook.sh
|
||||
RUN echo 'exec "$@"' >> /shell-hook.sh
|
||||
|
||||
# ===========================
|
||||
# Stage 1: Build frontend
|
||||
# ===========================
|
||||
FROM node:20 AS frontend-builder
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/frontend ./
|
||||
RUN npm install -g pnpm && pnpm install && pnpm build
|
||||
|
||||
# ===========================
|
||||
# Stage 2: Production (Nginx + Backend)
|
||||
# ===========================
|
||||
FROM ubuntu:24.04 AS production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install Nginx and runtime dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
nginx \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy pixi executable from builder
|
||||
COPY --from=builder /usr/local/bin/pixi /usr/local/bin/pixi
|
||||
RUN chmod +x /usr/local/bin/pixi
|
||||
|
||||
# Copy backend environment from builder
|
||||
COPY --from=builder /app/.pixi /app/.pixi
|
||||
COPY --from=builder /shell-hook.sh /shell-hook.sh
|
||||
|
||||
# Copy backend code
|
||||
COPY --from=builder /app/web /app/web
|
||||
COPY --from=builder /app/Data /app/Data
|
||||
COPY --from=builder /app/bttoxin /app/bttoxin
|
||||
COPY --from=builder /app/scripts /app/scripts
|
||||
|
||||
# Copy built frontend
|
||||
COPY --from=frontend-builder /app/dist /var/www/html
|
||||
|
||||
# Create jobs directory
|
||||
RUN mkdir -p /app/jobs && chmod 777 /app/jobs
|
||||
|
||||
# Configure Nginx
|
||||
RUN cat > /etc/nginx/sites-available/default << 'EOF'
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
root /var/www/html;
|
||||
index index.html;
|
||||
|
||||
# Gzip compression
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
|
||||
|
||||
# Allow uploads up to 100M
|
||||
client_max_body_size 100M;
|
||||
|
||||
# Frontend routes - serve index.html for SPA
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# API proxy to backend
|
||||
location /api/ {
|
||||
proxy_pass http://127.0.0.1:8000/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection 'upgrade';
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_cache_bypass $http_upgrade;
|
||||
}
|
||||
|
||||
# Health check endpoint
|
||||
location /health {
|
||||
proxy_pass http://127.0.0.1:8000/api/health;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
# Expose port
|
||||
EXPOSE 80
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost/health || exit 1
|
||||
|
||||
# Entrypoint
|
||||
ENTRYPOINT ["/bin/bash", "/shell-hook.sh"]
|
||||
|
||||
# Command: Start Nginx and Backend
|
||||
CMD ["bash", "-c", "\
|
||||
mkdir -p /app/jobs && \
|
||||
uvicorn web.backend.main:app --host 127.0.0.1 --port 8000 & \
|
||||
nginx -g 'daemon off;' \
|
||||
"]
|
||||
@@ -1,40 +1,38 @@
|
||||
# BtToxin Pipeline - Production Dockerfile (No Nginx)
|
||||
# This version is designed to work with Traefik as the reverse proxy.
|
||||
# FastAPI serves both the API and the frontend static files.
|
||||
# BtToxin Pipeline - Production Dockerfile
|
||||
# Optimized for Traefik deployment with unified context
|
||||
|
||||
# ===========================
|
||||
# Stage 1: Install dependencies using pixi
|
||||
# Stage 1: Builder (Environment & Code)
|
||||
# ===========================
|
||||
FROM ghcr.io/prefix-dev/pixi:latest AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy project files
|
||||
COPY pixi.toml .
|
||||
COPY pyproject.toml .
|
||||
COPY scripts/ scripts/
|
||||
COPY bttoxin/ bttoxin/
|
||||
COPY backend/ backend/
|
||||
COPY Data/ Data/
|
||||
# Copy entire project context (filtered by .dockerignore)
|
||||
COPY . .
|
||||
|
||||
# Install all pixi environments
|
||||
# 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
|
||||
RUN echo 'exec "$@"' >> /shell-hook.sh
|
||||
RUN pixi shell-hook -e webbackend > /shell-hook.sh && \
|
||||
echo 'exec "$@"' >> /shell-hook.sh
|
||||
|
||||
# ===========================
|
||||
# Stage 2: Build frontend
|
||||
# Stage 2: Frontend Builder
|
||||
# ===========================
|
||||
FROM docker.m.daocloud.io/library/node:latest AS frontend-builder
|
||||
|
||||
FROM docker.m.daocloud.io/library/node:20 AS frontend-builder
|
||||
WORKDIR /app
|
||||
|
||||
# Set CI environment variable to prevent pnpm TTY error
|
||||
ENV CI=true
|
||||
|
||||
# Copy frontend source
|
||||
# Copy only frontend source
|
||||
COPY frontend/ .
|
||||
|
||||
RUN npm install -g pnpm && \
|
||||
@@ -42,49 +40,37 @@ RUN npm install -g pnpm && \
|
||||
pnpm build
|
||||
|
||||
# ===========================
|
||||
# Stage 3: Production (FastAPI only)
|
||||
# Stage 3: Production (Runtime)
|
||||
# ===========================
|
||||
FROM docker.m.daocloud.io/library/ubuntu:20.04 AS production
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install runtime dependencies (only curl for healthcheck)
|
||||
# Install runtime dependencies
|
||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||
curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy pixi executable from builder
|
||||
# Copy pixi executable
|
||||
COPY --from=builder /usr/local/bin/pixi /usr/local/bin/pixi
|
||||
RUN chmod +x /usr/local/bin/pixi
|
||||
|
||||
# Copy backend environment from builder
|
||||
COPY --from=builder /app/.pixi /app/.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 backend code
|
||||
COPY --from=builder /app/backend /app/backend
|
||||
COPY --from=builder /app/Data /app/Data
|
||||
COPY --from=builder /app/bttoxin /app/bttoxin
|
||||
COPY --from=builder /app/scripts /app/scripts
|
||||
COPY --from=builder /app/pixi.toml /app/pixi.toml
|
||||
|
||||
# Copy built frontend
|
||||
# Copy built frontend assets
|
||||
COPY --from=frontend-builder /app/dist /app/frontend/dist
|
||||
|
||||
# Create jobs directory
|
||||
RUN mkdir -p /app/jobs && chmod 777 /app/jobs
|
||||
# Set permissions and cleanup
|
||||
RUN chmod -R 755 /app/frontend/dist && \
|
||||
mkdir -p /app/jobs && chmod 777 /app/jobs
|
||||
|
||||
# Expose port for FastAPI (will be used by Traefik)
|
||||
EXPOSE 8000
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:8000/health || exit 1
|
||||
|
||||
# Entrypoint
|
||||
ENTRYPOINT ["/bin/bash", "/shell-hook.sh"]
|
||||
|
||||
# Command: Start FastAPI backend
|
||||
# FastAPI will serve both API and frontend static files
|
||||
# Note: Using backend.app.main_spa for SPA static file support
|
||||
CMD ["uvicorn", "backend.app.main_spa:app", "--host", "0.0.0.0", "--port", "8000"]
|
||||
|
||||
Reference in New Issue
Block a user