Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/SantaClaas/wApp. Web App Store project to improve Web App discoverability written in Python for a u
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839# Based on https://medium.com/@albertazzir/blazing-fast-python-docker-builds-with-poetry-a78a66f5aed0
# The image used to buildFROM python:3.11 as builder
RUN pip install poetry==1.5.1
# Don't disable virutal environment as it can mess with poetry installation. This should be default in project settings already.# ENV POETRY_CACHE_DIR=/tmp/poetry_cacheENV 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 ./# A docker container probably doesn't need a readme but poetry will complain otherwiseRUN touch README.md
# Install dependencies first without project source code to improve docker build as this layer will be cached apparentlyRUN poetry install --without dev --no-root \ # Clean package cache used for package reuse after && rm -rf $POETRY_CACHE_DIR# Remove readme only used for build# && rm README.md# Run project without poetry dependency (use poetry only for build)# The smaller runtime image, used to just run the code provided its virtual environmentFROM python:3.11-slim-buster as runtime
ENV VIRTUAL_ENV=/app/.venv \ PATH="/app/.venv/bin:$PATH"
COPY --from=builder ${VIRTUAL_ENV} ${VIRTUAL_ENV}
# Copy source codeCOPY wappstore ./wappstore
ENTRYPOINT ["uvicorn", "wappstore.main:app", "--proxy-headers", "--host", "0.0.0.0", "--port", "80"]