nguyen-brat
commited on
Commit
•
1af1777
1
Parent(s):
0cf770a
update
Browse files- Dockerfile +19 -13
Dockerfile
CHANGED
@@ -2,7 +2,11 @@
|
|
2 |
FROM python:3.8
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
-
WORKDIR /app
|
|
|
|
|
|
|
|
|
6 |
|
7 |
# Install system dependencies
|
8 |
RUN apt-get update && apt-get install -y \
|
@@ -24,40 +28,42 @@ RUN apt-get update && apt-get install -y \
|
|
24 |
&& rm -rf /var/lib/apt/lists/* \
|
25 |
&& apt-get clean
|
26 |
|
27 |
-
WORKDIR /app
|
28 |
-
COPY --chown=user . /app
|
29 |
# Create .streamlit/config.toml file
|
30 |
RUN mkdir -p /app/.streamlit && \
|
31 |
echo "[server]\nenableXsrfProtection = false\nenableCORS = false" > /app/.streamlit/config.toml
|
32 |
|
33 |
# Clone the repository
|
34 |
-
RUN git clone https://github.com/nguyen-brat/text-remove.git /app/text-remove
|
35 |
|
36 |
# Set the working directory to the cloned repo
|
37 |
-
WORKDIR /app/text-remove
|
38 |
-
COPY --chown=user . /app/text-remove
|
39 |
-
RUN mkdir -p /app/text-remove/.streamlit && \
|
40 |
-
echo "[server]\nenableXsrfProtection = false\nenableCORS = false" > /app/text-remove/.streamlit/config.toml
|
41 |
|
42 |
# Install Python dependencies
|
43 |
COPY requirements.txt .
|
44 |
RUN pip install --no-cache-dir -r requirements.txt
|
45 |
|
46 |
# Set up Craft
|
47 |
-
WORKDIR /app/text-remove/CRAFT-pytorch
|
48 |
-
COPY --chown=user . /app/text-remove/CRAFT-pytorch
|
49 |
RUN wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1Jk4eGD7crsqCCg9C9VjCLkMN3ze8kutZ' -O "craft_mlt_25k.pth"
|
50 |
RUN pip install gdown
|
51 |
RUN gdown 1XSaFwBkOaFOdtk4Ane3DFyJGPRw6v5bO
|
52 |
|
53 |
# Set up lama
|
54 |
-
WORKDIR /app/text-remove/lama
|
55 |
-
COPY --chown=user . /app/text-remove/lama
|
56 |
RUN curl -LJO https://huggingface.co/smartywu/big-lama/resolve/main/big-lama.zip
|
57 |
RUN unzip big-lama.zip
|
58 |
|
59 |
# Set the working directory back to the root of the project
|
60 |
-
WORKDIR /app/text-remove
|
|
|
|
|
|
|
61 |
|
62 |
# Make port 7860 available to the world outside this container
|
63 |
EXPOSE 7860
|
|
|
2 |
FROM python:3.8
|
3 |
|
4 |
# Set the working directory in the container
|
5 |
+
WORKDIR $HOME/app
|
6 |
+
COPY --chown=user . $HOME/app
|
7 |
+
|
8 |
+
RUN useradd -m -u 1000 user
|
9 |
+
USER user
|
10 |
|
11 |
# Install system dependencies
|
12 |
RUN apt-get update && apt-get install -y \
|
|
|
28 |
&& rm -rf /var/lib/apt/lists/* \
|
29 |
&& apt-get clean
|
30 |
|
31 |
+
WORKDIR $HOME/app
|
|
|
32 |
# Create .streamlit/config.toml file
|
33 |
RUN mkdir -p /app/.streamlit && \
|
34 |
echo "[server]\nenableXsrfProtection = false\nenableCORS = false" > /app/.streamlit/config.toml
|
35 |
|
36 |
# Clone the repository
|
37 |
+
RUN git clone https://github.com/nguyen-brat/text-remove.git $HOME/app/text-remove
|
38 |
|
39 |
# Set the working directory to the cloned repo
|
40 |
+
WORKDIR $HOME/app/text-remove
|
41 |
+
COPY --chown=user . $HOME/app/text-remove
|
42 |
+
RUN mkdir -p $HOME/app/text-remove/.streamlit && \
|
43 |
+
echo "[server]\nenableXsrfProtection = false\nenableCORS = false" > $HOME/app/text-remove/.streamlit/config.toml
|
44 |
|
45 |
# Install Python dependencies
|
46 |
COPY requirements.txt .
|
47 |
RUN pip install --no-cache-dir -r requirements.txt
|
48 |
|
49 |
# Set up Craft
|
50 |
+
WORKDIR $HOME/app/text-remove/CRAFT-pytorch
|
51 |
+
COPY --chown=user . $HOME/app/text-remove/CRAFT-pytorch
|
52 |
RUN wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1Jk4eGD7crsqCCg9C9VjCLkMN3ze8kutZ' -O "craft_mlt_25k.pth"
|
53 |
RUN pip install gdown
|
54 |
RUN gdown 1XSaFwBkOaFOdtk4Ane3DFyJGPRw6v5bO
|
55 |
|
56 |
# Set up lama
|
57 |
+
WORKDIR $HOME/app/text-remove/lama
|
58 |
+
COPY --chown=user . $HOME/app/text-remove/lama
|
59 |
RUN curl -LJO https://huggingface.co/smartywu/big-lama/resolve/main/big-lama.zip
|
60 |
RUN unzip big-lama.zip
|
61 |
|
62 |
# Set the working directory back to the root of the project
|
63 |
+
WORKDIR $HOME/app/text-remove
|
64 |
+
|
65 |
+
RUN chmod 777 $HOME/app/text-remove/target_test
|
66 |
+
RUN chmod 777 $HOME/app/text-remove/test_folder
|
67 |
|
68 |
# Make port 7860 available to the world outside this container
|
69 |
EXPOSE 7860
|