-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update docker to use poetry to install dependencies
- Loading branch information
Showing
1 changed file
with
24 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
FROM python:3.9.7 as base | ||
COPY ./requirements.txt ./requirements.dev.txt / | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt-get -qq update && \ | ||
apt-get install -qq -y libpoppler-cpp-dev | ||
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /wheels -r requirements.txt && \ | ||
pip wheel --no-cache-dir --no-deps --wheel-dir /wheels -r requirements.dev.txt | ||
|
||
FROM python:3.9.7-slim | ||
RUN apt-get -qq update && \ | ||
apt-get install -qq libpoppler-cpp-dev && \ | ||
apt-get install -qq libpq5 && \ | ||
apt-get install -qq git postgresql-client | ||
WORKDIR /workspaces/caps/ | ||
ENV PYTHONDONTWRITEBYTECODE 1 | ||
ENV PYTHONUNBUFFERED 1 | ||
RUN pip install --upgrade pip | ||
COPY --from=base /wheels /wheels | ||
COPY --from=base requirements.txt requirements.dev.txt ./ | ||
RUN pip install --no-cache-dir /wheels/* | ||
FROM python:3.9 | ||
ENV INSIDE_DOCKER=1 \ | ||
PYTHONUNBUFFERED=1 \ | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 \ | ||
POETRY_VERSION=1.2.2 \ | ||
POETRY_VIRTUALENVS_CREATE=false \ | ||
PYSETUP_PATH="/opt/pysetup" | ||
RUN apt-get update && apt-get install -y \ | ||
binutils gdal-bin libproj-dev git npm \ | ||
libpoppler-cpp-dev postgresql-client \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN curl -sSL https://install.python-poetry.org | python - | ||
ENV PATH="/root/.local/bin:$PATH" | ||
WORKDIR $PYSETUP_PATH | ||
COPY poetry.lock pyproject.toml ./ | ||
RUN poetry install --no-root | ||
# Not needed (mapping handled by docker-compose) | ||
# WORKDIR /app | ||
# COPY . . | ||
#RUN ./manage.py collectstatic --no-input | ||
ARG BUILD_COMMIT | ||
LABEL revision=$BUILD_COMMIT | ||
WORKDIR /workspaces/caps | ||
COPY . . |