I am new to Python and kubernetes. I am trying to deploy a docker container in k8s pod on GCP and after an hr or so it is killed. Below is the docker file and the script that I am trying to execute.
FROM python:3.7-slim AS build
WORKDIR /app
COPY . .
RUN pip3 install pymysql && pip3 install waitress
ENV DICT_FILE="/opt/srv/projects.dict" \
MODEL_FILE="/opt/srv/projects.model.cpickle" \
INDEX_FILE="/opt/srv/projects.index" \
EXTERNAL_INDEX_FILE="/opt/srv/projects.mm.metadata.cpickle"
EXPOSE 5000
EXPOSE 3306
ENTRYPOINT ["/bin/sh", "serve.sh"]
serve.sh
#!/bin/sh
mkdir -p /opt/srv
python3 setup.py bdist_wheel
pip3 install dist/app_search*.whl && semanticsearch-preprocess
cp /app/dist/app_search*.whl /opt/srv/
cd /opt/srv
pip3 install app_search*.whl
waitress-serve --call app_search.app:main
The last log I see before the crash is
Successfully installed Flask-1.1.2 Jinja2-2.11.2 MarkupSafe-1.1.1 Werkzeug-0.16.1 aniso8601-8.0.0 attrs-20.2.0 certifi-2020.6.20 chardet-3.0.4 click-7.1.2 flask-restplus-0.12.1 gensim-3.6.0 idna-2.10 importlib-metadata-2.0.0 itsdangerous-1.1.0 jsonschema-3.2.0 numpy-1.19.2 pyrsistent-0.17.3 pytz-2020.1 requests-2.24.0 scipy-1.5.2 six-1.15.0 smart-open-3.0.0 app-search-0.0.9 urllib3-1.25.10 zipp-3.3.0
If I docker build and run on my local machine, the app works and is served on port 5000