diff --git a/backend/Py.Dockerfile b/backend/Py.Dockerfile index e1b44c4..977e524 100644 --- a/backend/Py.Dockerfile +++ b/backend/Py.Dockerfile @@ -1,37 +1,13 @@ -FROM continuumio/miniconda3 as build +FROM python:3.9 as runtime WORKDIR /app/ -COPY ./python/ /app/src/ +COPY ./python/ /app/ -RUN conda env create -f ./src/environment.yml +RUN python -m pip install gunicorn httpx flask -#RUN echo "conda activate cryptos" >> ~/.bashrc -#SHELL ["/bin/bash", "--login", "-c"] +EXPOSE 5001 -RUN conda install -c conda-forge conda-pack +CMD ["gunicorn", "-b", "0.0.0.0:5001", "crypto.index:app"] -RUN conda pack -n cryptos -o /tmp/env.tar && \ - mkdir /venv/ && cd /venv/ && tar xf /tmp/env.tar && \ - rm /tmp/env.tar - -RUN /venv/bin/conda-unpack - - -FROM python:buster as runtime - -WORKDIR /app/ - -COPY ./python/ /app/src/ -COPY ./automation/bin/ /app/bin/ - -COPY --from=build /venv/ /venv/ - -SHELL ["/bin/bash", "-c"] - -RUN pip install pyinstaller - -RUN pyinstaller -F -n coingecko --clean --log-level DEBUG --distpath /app/bin/ /app/src/coingecko.py && \ - pyinstaller -F -n mindicador --clean --log-level DEBUG --distpath /app/bin/ /app/src/miindicador.py - -ENTRYPOINT [ "/bin/bash" ] +#ENTRYPOINT [ "/bin/bash" ] diff --git a/backend/python/__pycache__/coingecko.cpython-39.pyc b/backend/python/__pycache__/coingecko.cpython-39.pyc index 0e76043..3f1e05b 100644 Binary files a/backend/python/__pycache__/coingecko.cpython-39.pyc and b/backend/python/__pycache__/coingecko.cpython-39.pyc differ diff --git a/backend/python/__pycache__/miindicador.cpython-39.pyc b/backend/python/__pycache__/miindicador.cpython-39.pyc index 3a00642..a4ba594 100644 Binary files a/backend/python/__pycache__/miindicador.cpython-39.pyc and b/backend/python/__pycache__/miindicador.cpython-39.pyc differ diff --git a/backend/python/crypto/__pycache__/coingecko.cpython-39.pyc b/backend/python/crypto/__pycache__/coingecko.cpython-39.pyc new file mode 100644 index 0000000..7f4fb9d Binary files /dev/null and b/backend/python/crypto/__pycache__/coingecko.cpython-39.pyc differ diff --git a/backend/python/crypto/__pycache__/index.cpython-39.pyc b/backend/python/crypto/__pycache__/index.cpython-39.pyc new file mode 100644 index 0000000..ed0b321 Binary files /dev/null and b/backend/python/crypto/__pycache__/index.cpython-39.pyc differ diff --git a/backend/python/crypto/__pycache__/miindicador.cpython-39.pyc b/backend/python/crypto/__pycache__/miindicador.cpython-39.pyc new file mode 100644 index 0000000..e37aa5e Binary files /dev/null and b/backend/python/crypto/__pycache__/miindicador.cpython-39.pyc differ diff --git a/backend/python/coingecko.py b/backend/python/crypto/coingecko.py similarity index 100% rename from backend/python/coingecko.py rename to backend/python/crypto/coingecko.py diff --git a/backend/python/crypto/index.py b/backend/python/crypto/index.py new file mode 100644 index 0000000..9ef4359 --- /dev/null +++ b/backend/python/crypto/index.py @@ -0,0 +1,50 @@ +from flask import Flask + +from crypto.coingecko import CoinGecko +from crypto.miindicador import MiIndicador + +app = Flask(__name__) + + +@app.route('/') +def main(): + output = [ + "", + "
", + "Welcome", + "", + "" + ] + return "\n".join(output) + + +@app.route('/crypto/historical/