Spaces:
Sleeping
Sleeping
Commit ·
4e7e6c5
1
Parent(s): 8aefb58
Update Dockerfile
Browse files12342 unmodified lines7891011121 unmodified line1415161718# Use the spaceread base Docker imageFROM circulartextapp/spaceread# Set the working directory to /app2 unmodified lines# Copy the current directory contents into the container at /appCOPY . /app# Install gosu (adjust the package manager based on your base image)RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*1 unmodified lineCOPY entrypoint.sh /usr/local/bin/entrypoint.shRUN chmod +x /usr/local/bin/entrypoint.sh# Default command to run if the user doesn't provide a commandCMD ["/usr/local/bin/entrypoint.sh", "${USERNAME:-default_user}"]12342 unmodified lines7891011121314151617181920212223242526272829301 unmodified line323334353637383940414243# Use a suitable base Docker image with necessary dependenciesFROM circulartextapp/spaceread# Set the working directory to /app2 unmodified lines# Copy the current directory contents into the container at /appCOPY . /app# Define the user ID in the environment variable USER_ID with a default valueARG USER_ID=1000ENV USER_ID=$USER_ID# Check if the user already existsRUN if [ -z "$USER_ID" ]; then \echo "User ID not provided. Using the default user ID 1000."; \USER_ID=1000; \fi && \if id "$USER_ID" >/dev/null 2>&1; then \echo "User with ID $USER_ID already exists."; \else \useradd -m -u "$USER_ID" user; \fi# Set appropriate permissions for the application directoryRUN chown -R user:user /app && chmod -R 755 /app# Install gosu (adjust the package manager based on your base image)RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*1 unmodified lineCOPY entrypoint.sh /usr/local/bin/entrypoint.shRUN chmod +x /usr/local/bin/entrypoint.sh# Switch to the user for improved securityUSER user# Define the entrypoint script to handle user creation and application startupENTRYPOINT ["/usr/local/bin/entrypoint.sh"]# Default command to run if the user doesn't provide a commandCMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
Dockerfile+27-2