-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
111 lines (95 loc) · 2.89 KB
/
Copy pathDockerfile
File metadata and controls
111 lines (95 loc) · 2.89 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Multi-stage build for optimized image size
FROM python:3.11-slim as base
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
vim \
wget \
libgomp1 \
# For pandas/numpy optimization
libblas-dev \
liblapack-dev \
gfortran \
# For PostgreSQL connections
libpq-dev \
# For image processing
libpng-dev \
libjpeg-dev \
# For Claude Code
ca-certificates \
gnupg \
lsb-release \
# Clean up
&& rm -rf /var/lib/apt/lists/*
# Install Node.js (required for Claude Code)
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y nodejs \
&& rm -rf /var/lib/apt/lists/*
# Install Stata (Note: You'll need to provide your Stata license)
# Uncomment and modify the following lines when you have Stata installation files
# COPY stata17-linux.tar.gz /tmp/
# RUN cd /tmp && tar -xzf stata17-linux.tar.gz && \
# cd stata17 && ./install && \
# rm -rf /tmp/stata*
# Set up Python environment
WORKDIR /workspace
# Install core Python packages first (for better caching)
RUN pip install --no-cache-dir \
"numpy<2.0" \
"pandas>=2.0,<2.2" \
"scipy>=1.10,<1.12" \
matplotlib \
seaborn \
jupyter \
jupyterlab \
ipython
# Install ML/NLP libraries with compatible versions
RUN pip install --no-cache-dir \
"scikit-learn>=1.3,<1.4" \
fuzzywuzzy \
python-Levenshtein \
"spacy>=3.6,<3.8" \
nltk
# Install PyTorch (CPU version)
RUN pip install --no-cache-dir \
torch==2.0.1 --index-url https://download.pytorch.org/whl/cpu
# Install TensorFlow (try latest available version)
RUN pip install --no-cache-dir tensorflow || \
pip install --no-cache-dir tensorflow-cpu || \
echo "TensorFlow installation failed, continuing without it"
# Download spaCy language model
RUN python -m spacy download en_core_web_sm
# Install additional useful libraries
RUN pip install --no-cache-dir \
plotly==5.15.0 \
dash==2.11.1 \
requests==2.31.0 \
beautifulsoup4==4.12.2 \
sqlalchemy==2.0.19 \
openpyxl==3.1.2 \
xlrd==2.0.1 \
pyarrow==12.0.1 \
fastparquet==2023.7.0 \
tqdm==4.65.0 \
black==23.7.0 \
pylint==2.17.4 \
pytest==7.4.0
# Install Claude Code CLI
RUN npm install -g @anthropic-ai/claude-code
# Configure Jupyter
RUN jupyter notebook --generate-config && \
echo "c.NotebookApp.token = ''" >> ~/.jupyter/jupyter_notebook_config.py && \
echo "c.NotebookApp.password = ''" >> ~/.jupyter/jupyter_notebook_config.py
# Set environment variables for better performance with large datasets
ENV PYTHONUNBUFFERED=1
ENV OMP_NUM_THREADS=4
ENV MKL_NUM_THREADS=4
ENV NUMEXPR_NUM_THREADS=4
# Create directories for data and notebooks
RUN mkdir -p /workspace/data /workspace/notebooks /workspace/code
# Expose ports for Jupyter and any web apps
EXPOSE 8888 8050
# Default command
CMD ["/bin/bash"]