File size: 1,329 Bytes
c75526e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Docker Best Practices for Bioinformatics

## Multi-stage Builds

### Optimized Python Environment
```dockerfile
# Build stage
FROM python:3.9-slim as builder
WORKDIR /build
COPY requirements.txt .
RUN pip install --no-cache-dir --user -r requirements.txt

# Production stage
FROM python:3.9-slim
COPY --from=builder /root/.local /root/.local
RUN apt-get update && apt-get install -y procps
WORKDIR /app
```

### Bioinformatics Stack
```dockerfile
FROM python:3.9-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    libhdf5-dev \
    libblas-dev \
    liblapack-dev \
    && rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir \
    scanpy>=1.9.0 \
    anndata>=0.8.0 \
    pandas>=1.5.0 \
    numpy>=1.21.0

WORKDIR /app
```

### OpenProblems Compatible Container
```dockerfile
FROM python:3.9-slim

RUN apt-get update && apt-get install -y procps
RUN pip install --no-cache-dir scanpy anndata pandas numpy

# Create non-root user for Nextflow
RUN groupadd -g 1000 nextflow && \
    useradd -u 1000 -g nextflow nextflow

USER nextflow
WORKDIR /app
ENTRYPOINT ["python"]
```

## Best Practices
- Use specific versions for reproducibility
- Use minimal base images
- Create non-root users
- Combine RUN commands to reduce layers
- Use health checks for services
- Set appropriate resource limits