gravity-dev / Dockerfile
broadfield-dev's picture
Update Dockerfile
63ccce0 verified
raw
history blame contribute delete
542 Bytes
# Dockerfile
FROM python:3.9-slim
# Create a non-root user and group
RUN groupadd -r app && useradd -r -g app app
WORKDIR /app
# Copy the requirements file and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy the application code
COPY . .
# Create the settings directory and set permissions
RUN mkdir -p settings && chown -R app:app settings && chmod -R 775 settings
# Expose the port
EXPOSE 7860
# Switch to the non-root user
USER app
# Run the Flask app
CMD ["python", "app.py"]