Spaces:
Sleeping
Sleeping
Commit
·
ed9b501
1
Parent(s):
3f0e6c7
Update Dockerfile
Browse files- Dockerfile +24 -41
Dockerfile
CHANGED
@@ -1,54 +1,37 @@
|
|
1 |
-
|
2 |
-
FROM circulartextapp/spaceread as base
|
3 |
|
4 |
-
#
|
5 |
-
|
|
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
|
10 |
-
# Define
|
11 |
-
|
12 |
-
ENV USER_ID=$USER_ID
|
13 |
-
|
14 |
-
# Check if the user already exists
|
15 |
-
RUN if id "$USER_ID" >/dev/null 2>&1; then \
|
16 |
-
echo "User with ID $USER_ID already exists."; \
|
17 |
-
else \
|
18 |
-
useradd -m -u "$USER_ID" user; \
|
19 |
-
fi
|
20 |
-
|
21 |
-
# Set appropriate permissions for the application directory
|
22 |
-
RUN chown -R user:user /app && chmod -R 755 /app
|
23 |
|
24 |
-
#
|
25 |
-
|
26 |
-
|
27 |
-
chmod 755 /var/lib/apt/lists/partial && \
|
28 |
-
apt-get update && apt-get install -y build-essential
|
29 |
-
|
30 |
-
# Switch to the user for improved security
|
31 |
-
USER user
|
32 |
|
33 |
-
#
|
34 |
-
|
35 |
|
36 |
-
#
|
37 |
-
|
38 |
|
39 |
-
#
|
40 |
-
|
41 |
|
42 |
-
#
|
43 |
-
COPY
|
44 |
|
45 |
-
#
|
46 |
-
|
47 |
-
RUN sudo chmod +x /usr/local/bin/entrypoint.sh
|
48 |
|
49 |
-
#
|
50 |
-
|
51 |
|
52 |
-
#
|
53 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|
54 |
|
|
|
1 |
+
FROM circulartextapp/lastread
|
|
|
2 |
|
3 |
+
# Define environment variables for user identification and configuration
|
4 |
+
ENV USER_ID=""
|
5 |
+
ENV USER_CONFIG=""
|
6 |
|
7 |
+
# Install Hugging Face dependencies
|
8 |
+
RUN pip install transformers datasets huggingface_hub
|
9 |
|
10 |
+
# Define additional user group for the application
|
11 |
+
RUN addgroup --system myappgroup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
+
# Add user with unique identifier and assign to the group
|
14 |
+
ARG USER_ID=1000
|
15 |
+
RUN adduser --system --group myappuser --uid ${USER_ID} user
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
+
# Set the working directory to /app
|
18 |
+
WORKDIR /app
|
19 |
|
20 |
+
# Copy the current directory contents into the container at /app
|
21 |
+
COPY . .
|
22 |
|
23 |
+
# Set appropriate permissions for the application directory
|
24 |
+
RUN chown -R user:myappgroup /app && chmod -R 775 /app
|
25 |
|
26 |
+
# Set environment variable for user configuration file (optional)
|
27 |
+
COPY user_config.json .
|
28 |
|
29 |
+
# Entrypoint script to personalize the environment and run the application
|
30 |
+
ENTRYPOINT ["/app/entrypoint.sh"]
|
|
|
31 |
|
32 |
+
# Expose Hugging Face space port (e.g., 7860)
|
33 |
+
EXPOSE 7860
|
34 |
|
35 |
+
# Example CMD for Hugging Face Space application (modify as needed)
|
36 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
|
37 |
|