FROM python:3.11.2
COPY . /app
WORKDIR /app
RUN pip install -r requirements/common.txt
RUN pip install -r requirements/requirements.txt
RUN python setup.py install
ENTRYPOINT ["python", "server.py"]
root@JYP-20200826XEG:/mnt/d/workspace/binance-connector-python# docker build -t binanceapi .
[+] Building 15.8s (11/11) FINISHED
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 251B 0.1s
=> [internal] load .dockerignore 0.1s
=> => transferring context: 2B 0.1s
=> [internal] load metadata for docker.io/library/python:3.11.2 1.3s
=> [internal] load build context 4.0s
=> => transferring context: 27.36kB 3.9s
=> CACHED [1/6] FROM docker.io/library/python:3.11.2@sha256:0d753a7365274cef746b34dde9b4aaa27644f64e1567ed8f40ccd191 0.0s
=> [2/6] COPY . /app 0.2s
=> [3/6] WORKDIR /app 0.1s
=> [4/6] RUN pip install -r requirements/common.txt 6.5s
=> [5/6] RUN pip install -r requirements/requirements.txt 1.2s
=> [6/6] RUN python setup.py install 1.7s
=> exporting to image 0.5s
=> => exporting layers 0.5s
=> => writing image sha256:880016eb792c998f2a4a9df3913bf1f312f41885a0ac42825345482aa64b4207 0.0s
=> => naming to docker.io/library/binanceapi 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
root@JYP-20200826XEG:/mnt/d/workspace/binance-connector-python# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
binanceapi latest 880016eb792c About a minute ago 951MB
hyewone/my-application v1.0.0 dc48b91435bd 31 hours ago 490MB
make-application v1 dc48b91435bd 31 hours ago 490MB
openjdk latest 71260f256d19 5 weeks ago 470MB
- 용량이 엄청납니다. 이미지 생성할때도 오래 걸리더라고요. 나중에 손 좀 봐야겠어요 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ
root@JYP-20200826XEG:/mnt/d/workspace/binance-connector-python# docker run -p 127.0.0.1:5000:5000 binanceapi
* Serving Flask app 'app'
* Debug mode: on
2023-03-17 17:15:14.111 UTC INFO werkzeug: WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on <http://127.0.0.1:5000>
* Running on <http://172.17.0.2:5000>
2023-03-17 17:15:14.112 UTC INFO werkzeug: Press CTRL+C to quit
2023-03-17 17:15:14.112 UTC INFO werkzeug: * Restarting with stat
2023-03-17 17:15:14.408 UTC WARNING werkzeug: * Debugger is active!
2023-03-17 17:15:14.414 UTC INFO werkzeug: * Debugger PIN: 785-391-082
2023-03-17 17:15:21.574 UTC INFO werkzeug: 172.17.0.1 - - [17/Mar/2023 17:15:21] "GET / HTTP/1.1" 200 -
2023-03-17 17:15:24.463 UTC INFO werkzeug: 172.17.0.1 - - [17/Mar/2023 17:15:24] "GET / HTTP/1.1" 200 -
2023-03-17 17:15:28.510 UTC DEBUG binance.api: url: <https://testnet.binance.vision/api/v3/ticker/price>
2023-03-17 17:15:28.513 UTC DEBUG urllib3.connectionpool: Starting new HTTPS connection (1): testnet.binance.vision:443
2023-03-17 17:15:29.098 UTC DEBUG urllib3.connectionpool: <https://testnet.binance.vision:443> "GET /api/v3/ticker/price?symbol=BTCUSDT HTTP/1.1" 200 45
2023-03-17 17:15:29.099 UTC DEBUG binance.api: raw response from server:{"symbol":"BTCUSDT","price":"26590.38000000"}
2023-03-17 17:15:29.099 UTC DEBUG binance.api: url: <https://testnet.binance.vision/api/v3/ticker/price>
2023-03-17 17:15:29.265 UTC DEBUG urllib3.connectionpool: <https://testnet.binance.vision:443> "GET /api/v3/ticker/price?symbol=BTCUSDT HTTP/1.1" 200 45
2023-03-17 17:15:29.266 UTC DEBUG binance.api: raw response from server:{"symbol":"BTCUSDT","price":"26590.38000000"}
2023-03-17 17:15:29.266 UTC INFO root: {'symbol': 'BTCUSDT', 'price': '26590.38000000'}
2023-03-17 17:15:29.266 UTC DEBUG binance.api: url: <https://testnet.binance.vision/api/v3/ticker/price>
2023-03-17 17:15:29.433 UTC DEBUG urllib3.connectionpool: <https://testnet.binance.vision:443> "GET /api/v3/ticker/price?symbols=%5B%22BTCUSDT%22%2C%22BNBUSDT%22%5D HTTP/1.1" 200 91
2023-03-17 17:15:29.434 UTC DEBUG binance.api: raw response from server:[{"symbol":"BNBUSDT","price":"333.40000000"},{"symbol":"BTCUSDT","price":"26590.38000000"}]
2023-03-17 17:15:29.434 UTC INFO root: [{'symbol': 'BNBUSDT', 'price': '333.40000000'}, {'symbol': 'BTCUSDT', 'price': '26590.38000000'}]
2023-03-17 17:15:29.434 UTC INFO werkzeug: 172.17.0.1 - - [17/Mar/2023 17:15:29] "GET /binance/test HTTP/1.1" 200 -
- 컨테이너 띄우고 포트바인딩까지 시켜줬어요. binance에서 정상적으로 데이터를 받아오네요.