Spaces:
Sleeping
Sleeping
Commit
·
0717a59
1
Parent(s):
4e18fa8
Delete Dockerfileworks
Browse files- Dockerfileworks +0 -38
Dockerfileworks
DELETED
@@ -1,38 +0,0 @@
|
|
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 |
-
|
7 |
-
# Copy the current directory contents into the container at /app
|
8 |
-
COPY . /app
|
9 |
-
|
10 |
-
# Define the username in the environment variable USERNAME with a default value
|
11 |
-
ARG USERNAME=default_user
|
12 |
-
ENV USERNAME=$USERNAME
|
13 |
-
|
14 |
-
# Check if the user already exists
|
15 |
-
RUN if id "$USERNAME" >/dev/null 2>&1; then \
|
16 |
-
echo "User $USERNAME already exists."; \
|
17 |
-
else \
|
18 |
-
useradd -m -u 1000 -s /bin/bash "$USERNAME"; \
|
19 |
-
fi
|
20 |
-
|
21 |
-
# Set appropriate permissions for the application directory
|
22 |
-
RUN chown -R "$USERNAME":"$USERNAME" /app && chmod -R 755 /app
|
23 |
-
|
24 |
-
# Install gosu (adjust the package manager based on your base image)
|
25 |
-
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
|
26 |
-
|
27 |
-
# Set the entrypoint script as executable
|
28 |
-
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
29 |
-
RUN chmod +x /usr/local/bin/entrypoint.sh
|
30 |
-
|
31 |
-
# Switch to the user for improved security
|
32 |
-
USER "$USERNAME"
|
33 |
-
|
34 |
-
# Define the entrypoint script to handle user creation and application startup
|
35 |
-
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
36 |
-
|
37 |
-
# Default command to run if the user doesn't provide a command
|
38 |
-
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|