Update docker image

This commit is contained in:
Andras Schmelczer 2022-07-09 21:50:22 +02:00
parent 01c496ec2e
commit 272ec7acc6
No known key found for this signature in database
GPG key ID: 0EA1BC97D0AB076E
4 changed files with 24 additions and 109 deletions

View file

@ -11,6 +11,6 @@ Dockerfile
.github
.vscode
docs
!docs/hello_world.py
scripts
tests
mkdocs.yaml

View file

@ -1,12 +1,14 @@
# syntax=docker/dockerfile:1.4
FROM python:3.10.4-slim-bullseye
LABEL org.opencontainers.image.title="GreatAI package wrapper container"
LABEL org.opencontainers.image.title="GreatAI package wrapper image"
LABEL org.opencontainers.image.vendor="ScoutinScience B.V."
LABEL org.opencontainers.image.authors="andras@schmelczer.dev"
LABEL org.opencontainers.image.source="https://github.com/schmelczer/great-ai"
SHELL ["/bin/bash", "-c"]
ENV ENVIRONMENT=production
EXPOSE 6060
# curl is needed for the healthcheck
# build-essentials are needed for building packages
@ -28,9 +30,17 @@ HEALTHCHECK \
CMD [ "curl", "--fail", "http://localhost:6060/health" ]
WORKDIR /app
VOLUME /app
COPY <<EOF hello_world.py
from great_ai import GreatAI
\
@GreatAI.create
def hello_world(name: str) -> str:
"""Learn more about GreatAI at https://great-ai.scoutinscience.com"""
return f"Hello {name}!"
EOF
COPY docs/hello_world.py .
EXPOSE 6060
VOLUME /app
ENTRYPOINT ["/usr/local/bin/python3", "-m", "great_ai"]
CMD ["hello_world.py"]

View file

@ -1,87 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[38;5;226m2022-07-08 10:26:12,806 | WARNING | Environment variable ENVIRONMENT is not set, defaulting to development mode ‼️\u001b[0m\n",
"\u001b[38;5;226m2022-07-08 10:26:12,807 | WARNING | Cannot find credentials files, defaulting to using ParallelTinyDbDriver\u001b[0m\n",
"\u001b[38;5;226m2022-07-08 10:26:12,807 | WARNING | The selected tracing database (ParallelTinyDbDriver) is not recommended for production\u001b[0m\n",
"\u001b[38;5;226m2022-07-08 10:26:12,808 | WARNING | Cannot find credentials files, defaulting to using LargeFileLocal\u001b[0m\n",
"\u001b[38;5;39m2022-07-08 10:26:12,808 | INFO | Settings: configured ✅\u001b[0m\n",
"\u001b[38;5;39m2022-07-08 10:26:12,809 | INFO | 🔩 tracing_database: ParallelTinyDbDriver\u001b[0m\n",
"\u001b[38;5;39m2022-07-08 10:26:12,809 | INFO | 🔩 large_file_implementation: LargeFileLocal\u001b[0m\n",
"\u001b[38;5;39m2022-07-08 10:26:12,811 | INFO | 🔩 is_production: False\u001b[0m\n",
"\u001b[38;5;39m2022-07-08 10:26:12,811 | INFO | 🔩 should_log_exception_stack: True\u001b[0m\n",
"\u001b[38;5;39m2022-07-08 10:26:12,812 | INFO | 🔩 prediction_cache_size: 512\u001b[0m\n",
"\u001b[38;5;39m2022-07-08 10:26:12,813 | INFO | 🔩 dashboard_table_size: 20\u001b[0m\n",
"\u001b[38;5;226m2022-07-08 10:26:12,813 | WARNING | You still need to check whether you follow all best practices before trusting your deployment.\u001b[0m\n",
"\u001b[38;5;226m2022-07-08 10:26:12,814 | WARNING | > Find out more at https://se-ml.github.io/practices/\u001b[0m\n"
]
}
],
"source": [
"from great_ai import GreatAI\n",
"from asyncio import sleep\n",
"\n",
"\n",
"@GreatAI.create\n",
"async def hello_world(name: str) -> str:\n",
" await sleep(1)\n",
" return f\"Hello {name}!\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Trace(trace_id='27c5e581-ad6e-4d50-bb77-862dfb7963fb', created='2022-07-08T08:26:12.911975', original_execution_time_ms=1.933, logged_values={'arg:name:value': 'hi', 'arg:name:length': 2}, models=[], exception=None, output='Hello hi!', feedback=None, tags=['hello_world', 'online', 'development'])"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"await hello_world('hi')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.10.4 ('.env': venv)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "02dd6d3afbfa9fbbe1037d64ad9014965528a1ccad21929d6e72f466389a68ad"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}

View file

@ -1,8 +0,0 @@
from great_ai import GreatAI
@GreatAI.create
def hello_world(name: str) -> str:
"""Learn more about GreatAI at https://github.com/schmelczer/great-ai"""
return f"Hello {name}!"