Spaces:
Runtime error
Runtime error
Matheus Frata
commited on
Commit
·
bdb6e6d
1
Parent(s):
f9df232
Add run-local files
Browse files- Dockerfile +49 -0
- Makefile +15 -0
Dockerfile
ADDED
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
ARG PYTHON_VERSION=3.10
|
2 |
+
FROM python:${PYTHON_VERSION} as base
|
3 |
+
|
4 |
+
RUN apt-get update && apt-get install -y \
|
5 |
+
git-lfs \
|
6 |
+
ffmpeg \
|
7 |
+
libsm6 \
|
8 |
+
libxext6 \
|
9 |
+
cmake \
|
10 |
+
libgl1-mesa-glx
|
11 |
+
|
12 |
+
RUN git lfs install
|
13 |
+
|
14 |
+
#COPY packages.txt /root/packages.txt
|
15 |
+
#RUN apt-get update && xargs -r -a /root/packages.txt apt-get install -y
|
16 |
+
|
17 |
+
RUN useradd -m user
|
18 |
+
USER user
|
19 |
+
|
20 |
+
|
21 |
+
FROM base as deps
|
22 |
+
|
23 |
+
ENV HOME /home/user
|
24 |
+
ENV PATH $HOME/.local/bin:$PATH
|
25 |
+
WORKDIR $HOME
|
26 |
+
RUN mkdir app
|
27 |
+
WORKDIR $HOME/app
|
28 |
+
|
29 |
+
ARG PIP_VERSION=22.1.1
|
30 |
+
RUN pip install \
|
31 |
+
pip==${PIP_VERSION} \
|
32 |
+
datasets \
|
33 |
+
huggingface-hub
|
34 |
+
|
35 |
+
COPY requirements.txt $HOME/app/requirements.txt
|
36 |
+
RUN pip install -r requirements.txt
|
37 |
+
|
38 |
+
|
39 |
+
from deps as app
|
40 |
+
|
41 |
+
COPY --chown=user ./app.py $HOME/app
|
42 |
+
|
43 |
+
ENV PYTHONPATH $HOME/app
|
44 |
+
ENV PYTHONUNBUFFERED 1
|
45 |
+
ENV GRADIO_ALLOW_FLAGGING never
|
46 |
+
ENV GRADIO_NUM_PORTS 1
|
47 |
+
ENV GRADIO_SERVER_NAME 0.0.0.0
|
48 |
+
ENV GRADIO_THEME huggingface
|
49 |
+
ENV SYSTEM spaces
|
Makefile
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
PROJECT_NAME := sentiment-analysis
|
2 |
+
DOCKER_RUN := docker run --rm -t -p 7860:7860 \
|
3 |
+
-v $(PROJECT_NAME):/home/user/.cache/
|
4 |
+
|
5 |
+
build:
|
6 |
+
docker build -t $(PROJECT_NAME) .
|
7 |
+
|
8 |
+
run:
|
9 |
+
$(DOCKER_RUN) $(PROJECT_NAME) python app.py
|
10 |
+
|
11 |
+
shell:
|
12 |
+
$(DOCKER_RUN) -i $(PROJECT_NAME) /bin/bash
|
13 |
+
|
14 |
+
clear:
|
15 |
+
docker volume rm $(PROJECT_NAME)
|