Spaces:
Sleeping
Sleeping
Optimize for Hugging Face Spaces with Java supporting
Browse files- Dockerfile +6 -4
Dockerfile
CHANGED
|
@@ -20,10 +20,12 @@ ENV HOME=/home/user \
|
|
| 20 |
JAVA_HOME=/usr/lib/jvm/default-java \
|
| 21 |
_JAVA_OPTIONS="-Xmx4g"
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
|
|
|
|
|
|
| 25 |
|
| 26 |
-
# Switch to the "user"
|
| 27 |
USER user
|
| 28 |
|
| 29 |
# Copy the requirements file and install dependencies as the "user"
|
|
@@ -33,7 +35,7 @@ RUN pip install --no-cache-dir --user -r requirements.txt
|
|
| 33 |
# Copy the rest of the application and set ownership
|
| 34 |
COPY --chown=user . .
|
| 35 |
|
| 36 |
-
# Create necessary directories
|
| 37 |
RUN mkdir -p data/input data/output data/save_pdf data/raw_csv_temp data/output_process_data data/strictly_cleaned_data logs
|
| 38 |
|
| 39 |
# Expose port 7860
|
|
|
|
| 20 |
JAVA_HOME=/usr/lib/jvm/default-java \
|
| 21 |
_JAVA_OPTIONS="-Xmx4g"
|
| 22 |
|
| 23 |
+
# Create the application directory and set permissions BEFORE switching users
|
| 24 |
+
# This ensures the 'user' has full write access to their own app folder
|
| 25 |
+
RUN mkdir -p /home/user/app && chown user:user /home/user/app
|
| 26 |
+
WORKDIR /home/user/app
|
| 27 |
|
| 28 |
+
# Switch to the "user"
|
| 29 |
USER user
|
| 30 |
|
| 31 |
# Copy the requirements file and install dependencies as the "user"
|
|
|
|
| 35 |
# Copy the rest of the application and set ownership
|
| 36 |
COPY --chown=user . .
|
| 37 |
|
| 38 |
+
# Create necessary data directories as the user
|
| 39 |
RUN mkdir -p data/input data/output data/save_pdf data/raw_csv_temp data/output_process_data data/strictly_cleaned_data logs
|
| 40 |
|
| 41 |
# Expose port 7860
|