Spaces:
Sleeping
Sleeping
# Use an official Python runtime as a parent image | |
FROM python:3.10-slim | |
# Install git and other necessary packages | |
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* | |
# Create a user with a non-root UID | |
RUN useradd -m -u 1000 user | |
# Set environment variables | |
ENV PATH="/home/user/.local/bin:$PATH" | |
ENV PYTHONDONTWRITEBYTECODE=1 | |
ENV PYTHONUNBUFFERED=1 | |
# Set the working directory and ensure it exists | |
WORKDIR /app | |
RUN chown user:user /app | |
# Copy the entrypoint script and set permissions | |
COPY entrypoint.sh /entrypoint.sh | |
RUN chmod +x /entrypoint.sh && chown user:user /entrypoint.sh | |
# Switch to the non-root user | |
USER user | |
# Expose the port your app runs on | |
EXPOSE 8080 | |
# Define the entrypoint | |
ENTRYPOINT ["/entrypoint.sh"] |