Spaces:
Sleeping
Sleeping
Commit
·
0a404a4
1
Parent(s):
26d8371
Update Dockerfile
Browse files- Dockerfile +7 -3
Dockerfile
CHANGED
|
@@ -7,12 +7,16 @@ WORKDIR /app
|
|
| 7 |
# Copy the current directory contents into the container at /app
|
| 8 |
COPY . /app
|
| 9 |
|
| 10 |
-
# Define the user ID in the environment variable USER_ID
|
| 11 |
-
ARG USER_ID
|
| 12 |
ENV USER_ID=$USER_ID
|
| 13 |
|
| 14 |
# Check if the user already exists
|
| 15 |
-
RUN if
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
echo "User with ID $USER_ID already exists."; \
|
| 17 |
else \
|
| 18 |
useradd -m -u "$USER_ID" user; \
|
|
|
|
| 7 |
# Copy the current directory contents into the container at /app
|
| 8 |
COPY . /app
|
| 9 |
|
| 10 |
+
# Define the user ID in the environment variable USER_ID with a default value
|
| 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; \
|