bsmit1659 commited on
Commit
48802c6
·
1 Parent(s): 8b3b6f0

Making "appuser" to run entrypoint and adding nonroot cache dir

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -0
Dockerfile CHANGED
@@ -90,6 +90,22 @@ FROM vllm-base AS vllm-openai
90
  RUN --mount=type=cache,target=/root/.cache/pip \
91
  pip install accelerate
92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  COPY --from=build /workspace/vllm/*.so /workspace/vllm/
94
  COPY vllm vllm
95
 
 
90
  RUN --mount=type=cache,target=/root/.cache/pip \
91
  pip install accelerate
92
 
93
+ # Create a non-root user
94
+ RUN useradd -m appuser
95
+
96
+ # Transfer ownership of the /workspace to the new non-root user
97
+ RUN chown -R appuser:appuser /workspace
98
+
99
+ # Create a cache directory within the appuser's home directory and transfer ownership
100
+ RUN mkdir -p /home/appuser/cache && \
101
+ chown -R appuser:appuser /home/appuser/cache
102
+
103
+ # Switch to the non-root user for subsequent commands and container runtime
104
+ USER appuser
105
+
106
+ # Set the Hugging Face cache directory environment variable
107
+ ENV TRANSFORMERS_CACHE=/home/appuser/cache
108
+
109
  COPY --from=build /workspace/vllm/*.so /workspace/vllm/
110
  COPY vllm vllm
111