Spaces:
Running
Running
fix pull
Browse files- Dockerfile +16 -27
Dockerfile
CHANGED
@@ -21,8 +21,17 @@ ENV HF_DATASETS_CACHE=/tmp/huggingface-cache
|
|
21 |
# Copy requirements từ project hiện tại
|
22 |
COPY requirements.txt .
|
23 |
|
24 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
26 |
|
27 |
# Copy code của API vào container
|
28 |
COPY . .
|
@@ -31,6 +40,9 @@ COPY . .
|
|
31 |
RUN mkdir -p /app/data
|
32 |
COPY ./data/* /app/data/
|
33 |
|
|
|
|
|
|
|
34 |
# Expose port
|
35 |
EXPOSE 7860
|
36 |
|
@@ -39,29 +51,6 @@ RUN useradd -m appuser
|
|
39 |
RUN chown -R appuser:appuser /app /tmp/matplotlib-cache /tmp/huggingface-cache
|
40 |
USER appuser
|
41 |
|
42 |
-
#
|
43 |
-
|
44 |
-
|
45 |
-
if [ -d "/app/meisai-check-ai" ]; then \n\
|
46 |
-
cd /app/meisai-check-ai && \n\
|
47 |
-
git fetch && \n\
|
48 |
-
git checkout chien_develop && \n\
|
49 |
-
git pull \n\
|
50 |
-
else \n\
|
51 |
-
git clone https://vumichien:${BITBUCKET_APP_PW}@bitbucket.org/dtm-partners/meisai-check-ai.git && \n\
|
52 |
-
cd meisai-check-ai && \n\
|
53 |
-
git checkout chien_develop \n\
|
54 |
-
fi \n\
|
55 |
-
\n\
|
56 |
-
# Cài đặt dependencies của AI module \n\
|
57 |
-
pip install --no-cache-dir -r /app/meisai-check-ai/requirements.txt \n\
|
58 |
-
\n\
|
59 |
-
# Thêm đường dẫn meisai-check-ai vào PYTHONPATH \n\
|
60 |
-
export PYTHONPATH="${PYTHONPATH}:/app/meisai-check-ai" \n\
|
61 |
-
\n\
|
62 |
-
# Chạy ứng dụng với Uvicorn \n\
|
63 |
-
uvicorn main:app --host 0.0.0.0 --port 7860 \n\
|
64 |
-
' > /app/start.sh && chmod +x /app/start.sh
|
65 |
-
|
66 |
-
# Chạy script khi container khởi động
|
67 |
-
CMD ["/app/start.sh"]
|
|
|
21 |
# Copy requirements từ project hiện tại
|
22 |
COPY requirements.txt .
|
23 |
|
24 |
+
# Clone repository meisai-check-ai từ Bitbucket sử dụng secret, checkout nhánh chien_develop và đảm bảo lấy code mới nhất
|
25 |
+
RUN --mount=type=secret,id=BITBUCKET_APP_PW,mode=0444,required=true \
|
26 |
+
git clone https://vumichien:$(cat /run/secrets/BITBUCKET_APP_PW)@bitbucket.org/dtm-partners/meisai-check-ai.git && \
|
27 |
+
cd meisai-check-ai && \
|
28 |
+
git checkout chien_develop && \
|
29 |
+
git pull origin chien_develop && \
|
30 |
+
cd ..
|
31 |
+
|
32 |
+
# Cài đặt dependencies
|
33 |
RUN pip install --no-cache-dir -r requirements.txt
|
34 |
+
RUN pip install --no-cache-dir -r meisai-check-ai/requirements.txt
|
35 |
|
36 |
# Copy code của API vào container
|
37 |
COPY . .
|
|
|
40 |
RUN mkdir -p /app/data
|
41 |
COPY ./data/* /app/data/
|
42 |
|
43 |
+
# Thêm đường dẫn meisai-check-ai vào PYTHONPATH
|
44 |
+
ENV PYTHONPATH="${PYTHONPATH}:/app/meisai-check-ai"
|
45 |
+
|
46 |
# Expose port
|
47 |
EXPOSE 7860
|
48 |
|
|
|
51 |
RUN chown -R appuser:appuser /app /tmp/matplotlib-cache /tmp/huggingface-cache
|
52 |
USER appuser
|
53 |
|
54 |
+
# Chạy ứng dụng với Uvicorn
|
55 |
+
# Lưu ý: Hugging Face Spaces sử dụng port 7860
|
56 |
+
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|