jmanhype
commited on
Commit
Β·
99e8bea
1
Parent(s):
06f972b
fix: update Dockerfile to use non-root user for git config
Browse files- Dockerfile +16 -10
Dockerfile
CHANGED
@@ -6,22 +6,28 @@ RUN apt-get update && apt-get install -y \
|
|
6 |
git \
|
7 |
&& rm -rf /var/lib/apt/lists/*
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
# This is a test Dockerfile to see if it's actually being used
|
10 |
-
RUN echo "TESTING IF THIS DOCKERFILE IS ACTUALLY USED" > /test_file.txt && \
|
11 |
-
echo "If you see this message, the correct Dockerfile is being used!"
|
12 |
-
cat /test_file.txt
|
13 |
|
14 |
# Create a very obvious test directory
|
15 |
-
RUN mkdir -p /THIS_IS_A_TEST_DIRECTORY && \
|
16 |
-
echo "TEST CONTENT" > /THIS_IS_A_TEST_DIRECTORY/test.txt
|
17 |
|
18 |
# Print test message during build
|
19 |
RUN echo "=================================================" && \
|
20 |
echo "THIS IS A TEST BUILD - IF YOU SEE THIS, THE DOCKERFILE IS BEING USED" && \
|
21 |
echo "================================================="
|
22 |
|
23 |
-
|
24 |
-
RUN git config --global user.email "[email protected]" && \
|
25 |
-
git config --global user.name "jmanhype"
|
26 |
-
|
27 |
-
CMD ["cat", "/test_file.txt"]
|
|
|
6 |
git \
|
7 |
&& rm -rf /var/lib/apt/lists/*
|
8 |
|
9 |
+
# Create a non-root user
|
10 |
+
RUN useradd -m -s /bin/bash huggingface
|
11 |
+
|
12 |
+
# Switch to the non-root user
|
13 |
+
USER huggingface
|
14 |
+
WORKDIR /home/huggingface
|
15 |
+
|
16 |
+
# Configure git for the user
|
17 |
+
RUN git config --global user.email "[email protected]" && \
|
18 |
+
git config --global user.name "jmanhype"
|
19 |
+
|
20 |
# This is a test Dockerfile to see if it's actually being used
|
21 |
+
RUN echo "TESTING IF THIS DOCKERFILE IS ACTUALLY USED" > /home/huggingface/test_file.txt && \
|
22 |
+
echo "If you see this message, the correct Dockerfile is being used!"
|
|
|
23 |
|
24 |
# Create a very obvious test directory
|
25 |
+
RUN mkdir -p /home/huggingface/THIS_IS_A_TEST_DIRECTORY && \
|
26 |
+
echo "TEST CONTENT" > /home/huggingface/THIS_IS_A_TEST_DIRECTORY/test.txt
|
27 |
|
28 |
# Print test message during build
|
29 |
RUN echo "=================================================" && \
|
30 |
echo "THIS IS A TEST BUILD - IF YOU SEE THIS, THE DOCKERFILE IS BEING USED" && \
|
31 |
echo "================================================="
|
32 |
|
33 |
+
CMD ["cat", "/home/huggingface/test_file.txt"]
|
|
|
|
|
|
|
|