File size: 3,194 Bytes
9f4f02b
39b1093
9f4f02b
 
eccf822
9f4f02b
eccf822
9f4f02b
eccf822
9f4f02b
eccf822
9f4f02b
eccf822
9f4f02b
eccf822
9f4f02b
 
 
 
 
 
 
 
 
2f54913
9f4f02b
2f54913
9f4f02b
 
 
2f54913
9f4f02b
 
 
2f54913
9f4f02b
 
 
39b1093
9f4f02b
 
 
39b1093
9f4f02b
 
 
 
 
 
 
 
 
5446c65
9f4f02b
 
 
 
9506cfc
3ecbbca
 
 
9f4f02b
 
 
3ecbbca
 
 
9f4f02b
 
 
 
3ecbbca
 
9f4f02b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3ecbbca
9f4f02b
 
 
90e4232
 
9f4f02b
 
90e4232
9f4f02b
3ecbbca
9f4f02b
90e4232
9f4f02b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# FROM python:3.11-bullseye

# LABEL organization="R6Q - Infraprasta University"
# LABEL team="Group 5"

# RUN useradd -m -u 1000 user

# WORKDIR /app

# COPY --chown=user ./requirements.txt requirements.txt

# RUN pip install --no-cache-dir --upgrade -r requirements.txt

# COPY --chown=user . /app

# RUN apt-get update && \
#     apt-get install -y gcc python3-dev gnupg curl

# RUN pip install cython
# RUN pip install onnxruntime==1.20.1

# RUN cd /app/restful/cutils && \
#     python setup.py build_ext --inplace && \
#     chmod 777 * && cd ../..

# # RUN pip install gdown

# # RUN --mount=type=secret,id=MODELS_ID,mode=0444,required=true \
# # 	gdown https://drive.google.com/uc?id=$(cat /run/secrets/MODELS_ID) && \
# #     unzip models.zip && rm models.zip

# # RUN --mount=type=secret,id=PICKLES_ID,mode=0444,required=true \
# # 	gdown https://drive.google.com/uc?id=$(cat /run/secrets/PICKLES_ID) && \
# #     unzip pickles.zip && rm pickles.zip

# # RUN --mount=type=secret,id=DATASETS_ID,mode=0444,required=true \
# # 	gdown https://drive.google.com/uc?id=$(cat /run/secrets/DATASETS_ID) && \
# #     unzip datasets.zip && rm datasets.zip

# # RUN --mount=type=secret,id=POSTTRAINED_ID,mode=0444,required=true \
# # 	gdown https://drive.google.com/uc?id=$(cat /run/secrets/POSTTRAINED_ID) && \
# #     unzip posttrained.zip && rm posttrained.zip

# # RUN git lfs install
# # RUN git clone https://huggingface.co/datasets/qywok/indonesia_stocks && ls && ls indonesia_stocks
# # RUN mkdir models && \
# #     for i in $(seq 1 10); do \
# #       git clone https://huggingface.co/qywok/stock_models_$i && \
# #       mv stock_models_$i/*.onnx models && \
# #       rm -rf stock_models_$i; \
# #     done && \
# #     ls models

# RUN apt install -y git-lfs && git lfs install

# RUN git clone https://huggingface.co/datasets/qywok/indonesia_stocks && \
#     ls && ls indonesia_stocks

# RUN mkdir models && \
#     for i in $(seq 1 10); do \
#       git clone https://huggingface.co/qywok/stock_models_$i && \
#       cd stock_models_$i && \
#       git lfs pull && \
#       cd .. && \
#       mv stock_models_$i/*.onnx models && \
#       rm -rf stock_models_$i; \
#     done && \
#     ls -lh models


# CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--workers", "5", "--port", "7860"]


FROM python:3.11-bullseye

LABEL organization="R6Q - Infraprasta University"
LABEL team="Group 5"

RUN useradd -m -u 1000 user

WORKDIR /app

COPY --chown=user ./requirements.txt requirements.txt
RUN apt-get update && \
    apt-get install -y gcc python3-dev git git-lfs curl && \
    pip install --no-cache-dir --upgrade -r requirements.txt && \
    pip install cython onnxruntime==1.20.1

COPY --chown=user . /app

RUN git lfs install && \
    git clone https://huggingface.co/datasets/qywok/indonesia_stocks && \
    mkdir -p models && \
    for i in $(seq 1 10); do \
      git clone https://huggingface.co/qywok/stock_models_$i && \
      cd stock_models_$i && git lfs pull && cd .. && \
      mv stock_models_$i/*.onnx models/ && \
      rm -rf stock_models_$i; \
    done

RUN chmod -R 755 /app

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]