Здравствуйте! Не получается собрать alpine образ приложения , написанного на веб-фреймах bottle (
https://bottlepy.org/docs/dev/deployment.html) и
bjoern(
https://github.com/jonashaag/bjoern/wiki/Installation).
приложение не суть важно:
...
if __name__ == '__main__':
run(host='0.0.0.0', port=8080, debug=False, server='bjoern')
pyptoject.toml:
...
[tool.poetry.dependencies]
python = "^3.11"
webptools = "^0.0.9"
bottle = "^0.12.25"
bjoern = "^3.2.2"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
Dockerfile:
FROM python:3.11.3-alpine AS python
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
FROM python AS poetry
ENV POETRY_HOME=/opt/poetry
ENV POETRY_VIRTUALENVS_IN_PROJECT=true
ENV PATH="$POETRY_HOME/bin:$PATH"
RUN apk upgrade --no-cache && \
apk add --no-cache gcc build-base libev-dev python3-dev
RUN python -c 'from urllib.request import urlopen; print(urlopen("https://install.python-poetry.org").read().decode())'\
| python -
COPY . ./
RUN poetry install --no-interaction --no-ansi -vvv --no-root
FROM python AS runtime
ENV PATH="/app/.venv/bin:$PATH"
COPY --from=poetry /app /app
CMD ["python", "-m", "src"]
Вне докера, локально запускает без проблем.
При сборке вылазит
ошибка:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/app/src/__main__.py", line 51, in <module>
run(host='0.0.0.0', port=8080, debug=False, server='bjoern')
File "/app/.venv/lib/python3.11/site-packages/bottle.py", line 3175, in run
server.run(app)
File "/app/.venv/lib/python3.11/site-packages/bottle.py", line 3014, in run
from bjoern import run
File "/app/.venv/lib/python3.11/site-packages/bjoern.py", line 3, in <module>
import _bjoern
--->>> ImportError: Error loading shared library libev.so.4: No such file or directory (needed by /app/.venv/lib/python3.11/site-packages/_bjoern.cpython-311-x86_64-linux-musl.so)
В чем может быть проблема?