File size: 1,576 Bytes
b759b87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use NVIDIA CUDA base image for GPU support
FROM nvidia/cuda:12.3.2-cudnn9-devel-ubuntu22.04

# Set the working directory
WORKDIR /app

# Update and install system dependencies (including Java and other tools)
RUN apt-get update && \
    apt-get install -y openjdk-11-jdk git rsync make build-essential libssl-dev zlib1g-dev \
    libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
    libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev \
    libffi-dev liblzma-dev git-lfs ffmpeg libsm6 libxext6 cmake \
    libgl1-mesa-glx && rm -rf /var/lib/apt/lists/* && git lfs install

# Set JAVA_HOME environment variable
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
ENV PATH="${JAVA_HOME}/bin:${PATH}"

# Install Python version manager (pyenv) and Python 3.10
RUN curl https://pyenv.run | bash
RUN pyenv install 3.10 && pyenv global 3.10 && pyenv rehash

# Install pip and other dependencies
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir datasets transformers langdetect streamlit

# Install PyTorch and CUDA dependencies
RUN pip install --no-cache-dir torch==1.13.1+cu117 torchvision==0.14.1 torchaudio==0.13.1

# Copy requirements.txt and install dependencies
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt

# Copy the application code to the container
COPY . /app/

# Expose the port the app will run on
EXPOSE 8501

# Set the environment variable for streamlit
ENV STREAMLIT_SERVER_PORT=8501
ENV STREAMLIT_SERVER_HEADLESS=true

# Command to run the application
CMD ["streamlit", "run", "app.py"]