autotrain-playground / Dockerfile
dsmueller's picture
Update Dockerfile to use Python virtual environment for package installation
cae1910
raw
history blame
1.03 kB
# Use an official Python runtime as a parent image
FROM python:3.11.1
# Set up user
RUN useradd -m -u 1000 user
USER user
# Install Cargo (Rust's package manager), needed for hf_transfer
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y
# Set up environment variables
ENV HOME=/home/user \
PATH=/home/user/.local/bin:/home/user/.cargo/bin:$PATH
# Set the working directory in the container
WORKDIR $HOME/app
# Copy the current directory contents into the container at /home/user/app
COPY --chown=user . $HOME/app
# Set user to root
USER root
# Install any needed packages specified in requirements.txt
RUN python -m venv /venv && \
/venv/bin/pip install --no-cache-dir -r requirements.txt
# Set user back to non-root
USER user
# Make port 80 available to the world outside this container
EXPOSE 80
# Define environment variable
# ENV NAME World
# Run train_llm.py when the container launches
CMD ["/bin/bash", "-c", "source /venv/bin/activate && python train_llm.py"]
# CMD ["/venv/bin/python", "train_llm.py"]