Commit
·
53c2b9d
1
Parent(s):
c69ef82
bug: trying to fix user file creation permission
Browse files- Dockerfile +25 -5
Dockerfile
CHANGED
@@ -2,8 +2,29 @@
|
|
2 |
|
3 |
FROM python:3.10
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
RUN git clone https://github.com/NeotomaDB/MetaExtractor.git
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
# Copy the requirements.txt file to the working directory
|
8 |
# COPY ./requirements.txt .
|
9 |
|
@@ -14,11 +35,7 @@ WORKDIR MetaExtractor/
|
|
14 |
|
15 |
ENV LOG_LEVEL=DEBUG
|
16 |
|
17 |
-
|
18 |
-
# changed from default 8050 to match HF spaces requirements
|
19 |
-
# edit the port in the app.py file
|
20 |
-
# inspired from: https://stackoverflow.com/questions/27713362/editing-files-from-dockerfile
|
21 |
-
RUN sed -i "s|port=8050|port=7860 |g" ./src/data_review_tool/app.py
|
22 |
EXPOSE 7860
|
23 |
|
24 |
RUN pip install pyarrow
|
@@ -33,4 +50,7 @@ ENV ENTITY_EXTRACTION_BATCH=entity-extraction-output.zip
|
|
33 |
RUN cp ./data/data-review-tool/article-relevance-output.parquet ./inputs \
|
34 |
&& cp ./data/data-review-tool/entity-extraction-output.zip ./inputs
|
35 |
|
|
|
|
|
|
|
36 |
ENTRYPOINT python src/data_review_tool/app.py
|
|
|
2 |
|
3 |
FROM python:3.10
|
4 |
|
5 |
+
# resolve spaces write permissions issue, sinpiration from: https://discuss.huggingface.co/t/permission-denied-for-writing-files-within-spaces/29799
|
6 |
+
RUN useradd -m -u 1000 user
|
7 |
+
# USER user
|
8 |
+
ENV HOME=/home/user \
|
9 |
+
PATH=/home/user/.local/bin:$PATH
|
10 |
+
|
11 |
+
WORKDIR $HOME/app
|
12 |
+
|
13 |
+
# COPY --chown=user . $HOME/app
|
14 |
+
|
15 |
RUN git clone https://github.com/NeotomaDB/MetaExtractor.git
|
16 |
|
17 |
+
# Expose the port your Dash app is running on
|
18 |
+
# changed from default 8050 to match HF spaces requirements
|
19 |
+
# edit the port in the app.py file
|
20 |
+
# inspired from: https://stackoverflow.com/questions/27713362/editing-files-from-dockerfile
|
21 |
+
# comment out file handle line due to file creation permission issues
|
22 |
+
RUN sed -i "s|port=8050|port=7860 |g" ./MetaExtractor/src/data_review_tool/app.py \
|
23 |
+
&& sed -i "s|logger.addHandler(get_file_handler())|#logger.addHandler(get_file_handler())|g" ./MetaExtractor/src/logs.py
|
24 |
+
|
25 |
+
# change ownership of the app folder to user
|
26 |
+
RUN chown -R root:user ./MetaExtractor/
|
27 |
+
|
28 |
# Copy the requirements.txt file to the working directory
|
29 |
# COPY ./requirements.txt .
|
30 |
|
|
|
35 |
|
36 |
ENV LOG_LEVEL=DEBUG
|
37 |
|
38 |
+
|
|
|
|
|
|
|
|
|
39 |
EXPOSE 7860
|
40 |
|
41 |
RUN pip install pyarrow
|
|
|
50 |
RUN cp ./data/data-review-tool/article-relevance-output.parquet ./inputs \
|
51 |
&& cp ./data/data-review-tool/entity-extraction-output.zip ./inputs
|
52 |
|
53 |
+
# switch to user to run the scripts
|
54 |
+
USER user
|
55 |
+
|
56 |
ENTRYPOINT python src/data_review_tool/app.py
|