Spaces:
Sleeping
Sleeping
circulartext
commited on
Commit
•
a81b246
1
Parent(s):
38a6645
Update Dockerfile
Browse files- Dockerfile +12 -6
Dockerfile
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
# Use a suitable base Docker image with necessary dependencies
|
2 |
FROM circulartextapp/spaceread
|
3 |
|
4 |
-
RUN adduser --uid 1000 --disabled-password --gecos '' appuser
|
5 |
-
USER 1000
|
6 |
-
|
7 |
-
|
8 |
# Set the working directory to /app
|
9 |
WORKDIR /app
|
10 |
|
@@ -15,9 +11,19 @@ COPY . /app
|
|
15 |
ARG USER_ID=1000
|
16 |
ENV USER_ID=$USER_ID
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
# Set appropriate permissions for the application directory
|
20 |
-
RUN chown -R
|
21 |
|
22 |
# Install gosu (adjust the package manager based on your base image)
|
23 |
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
|
@@ -27,7 +33,7 @@ COPY entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
27 |
RUN chmod +x /usr/local/bin/entrypoint.sh
|
28 |
|
29 |
# Switch to the user for improved security
|
30 |
-
USER
|
31 |
|
32 |
# Define the entrypoint script to handle user creation and application startup
|
33 |
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|
|
|
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 |
|
|
|
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 |
+
adduser --uid "$USER_ID" --disabled-password --gecos '' appuser; \
|
23 |
+
fi
|
24 |
|
25 |
# Set appropriate permissions for the application directory
|
26 |
+
RUN chown -R appuser:appuser /app && chmod -R 755 /app
|
27 |
|
28 |
# Install gosu (adjust the package manager based on your base image)
|
29 |
RUN apt-get update && apt-get install -y gosu && rm -rf /var/lib/apt/lists/*
|
|
|
33 |
RUN chmod +x /usr/local/bin/entrypoint.sh
|
34 |
|
35 |
# Switch to the user for improved security
|
36 |
+
USER appuser
|
37 |
|
38 |
# Define the entrypoint script to handle user creation and application startup
|
39 |
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|