likhonsheikh commited on
Commit
c269602
·
verified ·
1 Parent(s): d079716

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -33
Dockerfile CHANGED
@@ -1,42 +1,28 @@
1
- # Optimized Dockerfile for faster startup times
2
- # Base image with more pre-installed packages
3
- FROM python:3.9
4
 
5
  WORKDIR /app
6
 
7
- # Install system dependencies in a single layer with cleanup
8
- RUN apt-get update && apt-get install -y \
9
- curl \
10
- unzip \
11
- git \
12
- wget \
13
- build-essential \
14
- && apt-get clean \
15
- && rm -rf /var/lib/apt/lists/*
16
-
17
- # Install code-server with specific version for consistency
18
  RUN curl -fsSL https://code-server.dev/install.sh | sh -s -- --version=4.16.1
19
 
20
- # Create requirements.txt for better caching
21
- COPY requirements.txt .
22
-
23
- # Install Python packages with optimized flags
24
- RUN pip install --no-cache-dir --upgrade pip && \
25
- pip install --no-cache-dir -r requirements.txt
 
 
 
26
 
27
- # Pre-install VS Code extensions (this can be slow, so we do it early for better caching)
28
- RUN code-server --install-extension ms-python.python \
29
- --install-extension ms-toolsai.jupyter \
30
- --install-extension ms-vscode.vscode-json \
31
- --install-extension ms-python.autopep8 \
32
- --install-extension ms-python.flake8
33
 
34
- # Create a startup script for faster initialization
35
- COPY start.sh /app/start.sh
36
- RUN chmod +x /app/start.sh
37
 
38
- # Expose port
39
  EXPOSE 8080
40
-
41
- # Use the startup script
42
- CMD ["/app/start.sh"]
 
1
+ # Ultra-fast alternative using a pre-built base
2
+ FROM continuumio/miniconda3:latest
 
3
 
4
  WORKDIR /app
5
 
6
+ # Install code-server quickly
 
 
 
 
 
 
 
 
 
 
7
  RUN curl -fsSL https://code-server.dev/install.sh | sh -s -- --version=4.16.1
8
 
9
+ # Use conda for faster package management
10
+ RUN conda install -c conda-forge -y \
11
+ pytorch torchvision torchaudio cpuonly \
12
+ transformers \
13
+ scikit-learn \
14
+ pandas \
15
+ jupyter \
16
+ matplotlib \
17
+ && conda clean -a
18
 
19
+ # Quick pip installs for packages not in conda
20
+ RUN pip install --no-cache-dir datasets streamlit
 
 
 
 
21
 
22
+ # Install extensions in background during startup
23
+ COPY install-extensions.sh /app/
24
+ RUN chmod +x /app/install-extensions.sh
25
 
26
+ # Minimal startup
27
  EXPOSE 8080
28
+ CMD ["bash", "-c", "/app/install-extensions.sh & code-server --bind-addr 0.0.0.0:8080 --auth none /app"]