circulartext commited on
Commit
d516448
1 Parent(s): 7aef42c

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +30 -0
Dockerfile ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a suitable base Docker image with necessary dependencies
2
+ FROM circulartextapp/readspaceout
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
+ # Copy user and group information from the base image
11
+ COPY --from=circulartextapp/readspaceout /etc/passwd /etc/passwd
12
+ COPY --from=circulartextapp/readspaceout /etc/group /etc/group
13
+
14
+ # Set appropriate permissions for the application directory using UID and GID
15
+ RUN if getent passwd user > /dev/null 2>&1 && getent group user > /dev/null 2>&1; then \
16
+ chown -R "$USER_ID":"$USER_GROUP" /app && chmod -R 755 /app; \
17
+ fi
18
+
19
+ # Install gosu (adjust the package manager based on your base image)
20
+ RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
21
+
22
+ # Set the entrypoint script as executable
23
+ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
24
+ RUN chmod +x /usr/local/bin/entrypoint.sh
25
+
26
+ # Define the entrypoint script to handle user creation and application startup
27
+ ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
28
+
29
+ # Default command to run if the user doesn't provide a command
30
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]