Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +8 -34
Dockerfile
CHANGED
|
@@ -1,42 +1,16 @@
|
|
| 1 |
# Use your base Docker image from Docker Hub
|
| 2 |
FROM circulartextapp/circulartextai
|
| 3 |
|
| 4 |
-
# Set the working directory
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
-
# Copy the
|
| 8 |
-
COPY . /code
|
|
|
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
ENV USER_ID=$USER_ID
|
| 13 |
-
|
| 14 |
-
# Check if the user already exists
|
| 15 |
-
RUN if [ -z "$USER_ID" ]; then \
|
| 16 |
-
echo "User ID not provided. Using the default user ID 1000."; \
|
| 17 |
-
USER_ID=1000; \
|
| 18 |
-
fi && \
|
| 19 |
-
if id "$USER_ID" >/dev/null 2>&1; then \
|
| 20 |
-
echo "User with ID $USER_ID already exists."; \
|
| 21 |
-
else \
|
| 22 |
-
adduser --uid "$USER_ID" --disabled-password --gecos '' appuser; \
|
| 23 |
-
fi
|
| 24 |
-
|
| 25 |
-
# Set appropriate permissions for the application directory
|
| 26 |
-
RUN chown -R appuser:appuser /code && chmod -R 755 /app
|
| 27 |
-
|
| 28 |
-
# Install gosu (adjust the package manager based on your base image)
|
| 29 |
-
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
|
| 30 |
-
|
| 31 |
-
# Set the entrypoint script as executable
|
| 32 |
-
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
| 33 |
-
RUN chmod +x /usr/local/bin/entrypoint.sh
|
| 34 |
-
|
| 35 |
-
# Switch to the user for improved security
|
| 36 |
-
USER appuser
|
| 37 |
-
|
| 38 |
-
# Define the entrypoint script to handle user creation and application startup
|
| 39 |
-
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
| 40 |
|
| 41 |
# Specify the command to run your application
|
| 42 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860",
|
|
|
|
|
|
| 1 |
# Use your base Docker image from Docker Hub
|
| 2 |
FROM circulartextapp/circulartextai
|
| 3 |
|
| 4 |
+
# Set the working directory
|
| 5 |
WORKDIR /code
|
| 6 |
|
| 7 |
+
# Copy the requirements file and install dependencies
|
| 8 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 10 |
|
| 11 |
+
# Copy the rest of your application files
|
| 12 |
+
COPY . .
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Specify the command to run your application
|
| 15 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", --reload]
|
| 16 |
+
|