web-server / Dockerfile
pvanand's picture
Update Dockerfile
0de35ca verified
raw
history blame contribute delete
833 Bytes
# Use an official Python runtime as a parent image
FROM python:3.10.9
# Set the working directory in the container
WORKDIR /app
# Create necessary directories
RUN mkdir -p /app/sites /app/temp
# Copy requirements first for better caching
COPY requirements.txt /app/
# Requirements for the static site server
RUN pip install --no-cache-dir -r requirements.txt
# Create a non-root user
RUN useradd -m appuser
# Set up proper permissions
RUN chown -R appuser:appuser /app && \
chmod -R 755 /app && \
chmod -R 777 /app/sites /app/temp
# Copy the application code
COPY . /app/
# Set proper ownership for copied files
RUN chown -R appuser:appuser /app
# Switch to non-root user
USER appuser
# Expose the port
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]