File size: 942 Bytes
1984ccf
 
3658992
f9900a1
 
c0e77ac
f9900a1
 
c0e77ac
7b8fd64
 
934aa4a
 
 
 
 
 
 
 
 
 
e410ca7
934aa4a
1984ccf
 
 
7eeb965
 
1984ccf
e410ca7
934aa4a
e410ca7
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
# Use the base Docker image with necessary dependencies
FROM circulartextapp/spaceread as base

# 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

# Check if the user already exists
RUN if id "$USER_ID" >/dev/null 2>&1; then \
      echo "User with ID $USER_ID already exists."; \
    else \
      useradd -m -u "$USER_ID" user; \
    fi

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

# Switch to the user for improved security
USER user

# Copy gosu from the packages image (assumed that gosu is already available in spaceread image)
COPY --from=base /usr/sbin/gosu /usr/sbin/gosu

# Copy entrypoint.sh separately
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh