triventure_ai / Dockerfile
darkbreakerk's picture
Create Work Flow and guest weights
49ecd5d
raw
history blame contribute delete
982 Bytes
# Use an official Python runtime as the base image
FROM python:3.10.9
# Set the working directory to /app (root for your code inside the container)
WORKDIR /app
# Copy the requirements file into the container
COPY requirements.txt /app/
# Install dependencies in a virtual environment
RUN python3 -m venv /venv \
&& /venv/bin/pip install --upgrade pip \
&& /venv/bin/pip install -r /app/requirements.txt
# Copy the rest of your application code into the container
COPY . /app/
# Set the environment variable for the virtual environment
ENV PATH="/venv/bin:$PATH"
# Expose the port that your app will run on
EXPOSE 7860
# Create a non-root user and switch to that user to avoid running as root
RUN useradd -m myuser
# Give the non-root user permission to write to the Datasets/Weights directory
RUN chown -R myuser:myuser /app/Datasets
# Switch to the non-root user
USER myuser
# Run the Python script when the container starts
CMD ["python3", "Model_API/main.py"]