Spaces:
Sleeping
Sleeping
Commit
·
769bb43
1
Parent(s):
eb77908
Update Dockerfile
Browse files- Dockerfile +19 -10
Dockerfile
CHANGED
|
@@ -1,23 +1,33 @@
|
|
| 1 |
# Use a suitable base Docker image with necessary dependencies
|
| 2 |
-
FROM circulartextapp/
|
| 3 |
|
| 4 |
# Set the working directory to /app
|
| 5 |
WORKDIR /app
|
| 6 |
-
|
| 7 |
# Copy the current directory contents into the container at /app
|
| 8 |
COPY . /app
|
| 9 |
|
| 10 |
-
#
|
| 11 |
-
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# Set appropriate permissions for the application directory
|
| 15 |
-
RUN chown -R
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# Install gosu (adjust the package manager based on your base image)
|
| 18 |
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
|
| 19 |
-
|
| 20 |
-
# Set the entrypoint script as executable
|
| 21 |
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
| 22 |
RUN chmod +x /usr/local/bin/entrypoint.sh
|
| 23 |
|
|
@@ -28,6 +38,5 @@ USER user
|
|
| 28 |
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
| 29 |
|
| 30 |
# Default command to run if the user doesn't provide a command
|
| 31 |
-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
| 32 |
-
|
| 33 |
|
|
|
|
| 1 |
# Use a suitable base Docker image with necessary dependencies
|
| 2 |
+
FROM circulartextapp/spaceread
|
| 3 |
|
| 4 |
# Set the working directory to /app
|
| 5 |
WORKDIR /app
|
|
|
|
| 6 |
# Copy the current directory contents into the container at /app
|
| 7 |
COPY . /app
|
| 8 |
|
| 9 |
+
# Define the user ID in the environment variable USER_ID with a default value
|
| 10 |
+
ARG USER_ID=1000
|
| 11 |
+
ENV USER_ID=$USER_ID
|
| 12 |
+
|
| 13 |
+
# Check if the user already exists
|
| 14 |
+
RUN if [ -z "$USER_ID" ]; then \
|
| 15 |
+
echo "User ID not provided. Using the default user ID 1000."; \
|
| 16 |
+
USER_ID=1000; \
|
| 17 |
+
fi && \
|
| 18 |
+
if id "$USER_ID" >/dev/null 2>&1; then \
|
| 19 |
+
echo "User with ID $USER_ID already exists."; \
|
| 20 |
+
else \
|
| 21 |
+
useradd -m -u "$USER_ID" user; \
|
| 22 |
+
fi
|
| 23 |
|
| 24 |
# Set appropriate permissions for the application directory
|
| 25 |
+
RUN chown -R user:user /app && chmod -R 755 /app
|
| 26 |
+
|
| 27 |
+
|
| 28 |
|
| 29 |
# Install gosu (adjust the package manager based on your base image)
|
| 30 |
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
|
|
|
|
|
|
|
| 31 |
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
| 32 |
RUN chmod +x /usr/local/bin/entrypoint.sh
|
| 33 |
|
|
|
|
| 38 |
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
| 39 |
|
| 40 |
# Default command to run if the user doesn't provide a command
|
| 41 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|
|
|
|
| 42 |
|