circulartext commited on
Commit
70ff3d5
·
verified ·
1 Parent(s): 4ede87b

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +7 -20
Dockerfile CHANGED
@@ -1,9 +1,9 @@
1
  # Use your base Docker image from Docker Hub
2
  FROM circulartextapp/thecircworld
3
 
4
-
5
  # Set the working directory to /app
6
  WORKDIR /app
 
7
  # Copy the current directory contents into the container at /app
8
  COPY . /app
9
 
@@ -11,33 +11,20 @@ COPY . /app
11
  ARG USER_ID=1000
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
- useradd -m -u "$USER_ID" user; \
23
- fi
24
-
25
- # Set appropriate permissions for the application directory
26
- RUN chown -R user:user /app && chmod -R 755 /app
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
 
 
 
 
34
  # Switch to the user for improved security
35
  USER user
36
 
37
  # Define the entrypoint script to handle user creation and application startup
38
  ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
39
 
40
- # Specify the command to run your application
41
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]
42
-
43
 
 
1
  # Use your base Docker image from Docker Hub
2
  FROM circulartextapp/thecircworld
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
 
 
11
  ARG USER_ID=1000
12
  ENV USER_ID=$USER_ID
13
 
14
+ # Install necessary packages (using `apt` for Debian-based images)
15
+ RUN apt update && apt install -y gosu
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
+ # Copy the entrypoint script
 
18
  COPY entrypoint.sh /usr/local/bin/entrypoint.sh
19
  RUN chmod +x /usr/local/bin/entrypoint.sh
20
 
21
+ # Set appropriate permissions for the application directory
22
+ RUN chown -R user:user /app && chmod -R 755 /app
23
+
24
  # Switch to the user for improved security
25
  USER user
26
 
27
  # Define the entrypoint script to handle user creation and application startup
28
  ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
29
 
 
 
 
30