Spaces:
Paused
Paused
File size: 976 Bytes
90c17df 48e00e6 7d683e6 90c17df 43015c8 90c17df 43015c8 90c17df 43015c8 90c17df 48e00e6 90c17df e359b32 6cf9bee 90c17df 48e00e6 90c17df 48e00e6 e359b32 f11f24f e359b32 48e00e6 90c17df |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# The builder image, used to build the virtual environment
FROM python:3.11-buster as builder
RUN pip install poetry==1.4.2
ENV POETRY_NO_INTERACTION=1 \
POETRY_VIRTUALENVS_IN_PROJECT=1 \
POETRY_VIRTUALENVS_CREATE=1 \
POETRY_CACHE_DIR=/tmp/poetry_cache
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN --mount=type=cache,target=$POETRY_CACHE_DIR poetry install --without dev --no-root
# The runtime image, used to just run the code provided its virtual environment
FROM python:3.11-slim-buster as runtime
# Get secret DB_URL and output it to /test at buildtime
# RUN --mount=type=secret,id=DB_URL,mode=0444,required=true \
# cat /run/secrets/DB_URL > /test
ENV VIRTUAL_ENV=/app/.venv \
PATH="/app/.venv/bin:$PATH"
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
COPY image_search /image_search
COPY static /static
COPY images /images
RUN ls -la ${VIRTUAL_ENV}
CMD ["uvicorn", "image_search.main:app", "--host", "0.0.0.0", "--port", "7860"]
|