File size: 1,129 Bytes
5972a0e
 
 
38a6645
 
 
 
5972a0e
 
 
 
 
 
f5a2123
 
 
 
 
 
 
 
5972a0e
 
 
 
 
 
 
f5a2123
 
 
 
 
2015e28
f5a2123
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Use a suitable base Docker image with necessary dependencies
FROM circulartextapp/spaceread

RUN adduser --uid 1000 --disabled-password --gecos '' appuser
USER 1000


# Set the working directory to /app
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Define the user ID in the environment variable USER_ID with a default value
ARG USER_ID=1000
ENV USER_ID=$USER_ID


# Set appropriate permissions for the application directory
RUN chown -R user:user /app && chmod -R 755 /app

# Install gosu (adjust the package manager based on your base image)
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*

# Set the entrypoint script as executable
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh

# Switch to the user for improved security
USER user

# Define the entrypoint script to handle user creation and application startup
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

# Default command to run if the user doesn't provide a command
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860", "--reload"]