Guest User

Code

a guest
Apr 8th, 2025
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | Source Code | 0 0
  1. +- Changes
  2. RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev --no-root
  3. ->
  4. RUN poetry install --without dev --no-root
  5.  
  6. ENV VIRTUAL_ENV=/app/.venv \
  7. PATH="/app/.venv/bin:$PATH"
  8. ->
  9. WORKDIR /app
  10. COPY --from=builder /app/.venv /app/.venv
  11. ENV PATH="/app/.venv/bin:$PATH"
  12. COPY ./app /app/app
  13.  
  14. COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
  15. WORKDIR /
  16. COPY ./app /app
  17. COPY ./app/franken.db /franken.db
  18. ->
  19. COPY ./app/static /app/static
  20. EXPOSE 8888
  21.  
  22. Current Dockerile looks like this:
  23. FROM python:3.11-slim AS builder
  24. WORKDIR /app
  25. COPY pyproject.toml poetry.lock ./
  26. RUN poetry install --without dev --no-root && test -d /app/.venv
  27. FROM python:3.11-slim-bullseye
  28. RUN apt-get update && \
  29. apt-get install -y --no-install-recommends \
  30. libgomp1 \
  31. libatlas-base-dev \
  32. liblapack-dev && \
  33. apt-get clean && \
  34. rm -rf /var/lib/apt/lists/*
  35. WORKDIR /app
  36. COPY --from=builder /app/.venv /app/.venv
  37. ENV PATH="/app/.venv/bin:$PATH"
  38. COPY ./app /app/app
  39. COPY ./app/static /app/static
  40. EXPOSE 8888
  41. CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8888", "--reload"]
  42.  
  43.  
  44. Additions
  45. +
  46. PHONY: build run dev stop clean logs
  47. build:
  48. docker compose build
  49. dev:
  50. docker compose up
  51. run:
  52. docker compose up -d
  53. stop:
  54. docker compose down
  55. logs:
  56. docker compose logs -f
  57. clean:
  58. docker compose down --rmi all --volumes --remove-orphans
  59.  
  60. +
  61. services:
  62. app:
  63. build:
  64. context: .
  65. dockerfile: Dockerfile
  66. ports:
  67. - "8888:8888"
  68. env_file:
  69. - .env
  70. volumes:
  71. - ./app:/app/app
  72. command: ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8888", "--reload", "--reload-dir", "/app/app"]
  73.  
  74. +
  75. [metrics]
  76. port = 8080
  77. path = "/metrics"
  78. app = "quich-search"
  79.  
  80.  
  81. [tool.poetry.dev-dependencies] -> [tool.poetry.group.dev.dependencies]
  82.  
Advertisement
Add Comment
Please, Sign In to add comment