|
| 1 | +FROM windpioneers/gdal-python:rational-swordtail-gdal-3.10.0-python-3.12-slim |
| 2 | + |
| 3 | +# Ensure print statements and log messages appear promptly in Cloud Logging. |
| 4 | +ENV PYTHONUNBUFFERED=True |
| 5 | + |
| 6 | +ENV PROJECT_ROOT=/workspace |
| 7 | +WORKDIR $PROJECT_ROOT |
| 8 | + |
| 9 | +RUN apt-get update -y && apt-get install -y --fix-missing build-essential && rm -rf /var/lib/apt/lists/* |
| 10 | + |
| 11 | +# Install poetry. |
| 12 | +ENV POETRY_HOME=/root/.poetry |
| 13 | +ENV PATH="$POETRY_HOME/bin:$PATH" |
| 14 | +RUN curl -sSL https://install.python-poetry.org | python3 - && poetry config virtualenvs.create false; |
| 15 | + |
| 16 | +# Copy in the dependencies file(s) for caching. One or more of `requirements.txt`, `setup.py`, and `pyproject.toml and |
| 17 | +# `poetry.lock` must be present. |
| 18 | +COPY pyproject.tom[l] poetry.loc[k] setup.p[y] requirements.tx[t] ./ |
| 19 | + |
| 20 | +# If `pyproject.toml` is present, install the dependencies only to utilise layer caching for quick rebuilds. |
| 21 | +RUN if [ -f "pyproject.toml" ]; then poetry install \ |
| 22 | + --no-ansi \ |
| 23 | + --no-interaction \ |
| 24 | + --no-cache \ |
| 25 | + --no-root \ |
| 26 | + --only main; \ |
| 27 | + fi |
| 28 | + |
| 29 | +# Copy local code to the application root directory. |
| 30 | +COPY . . |
| 31 | + |
| 32 | +# Install local packages if using poetry. Otherwise, install everything if using `setup.py` or `requirements.txt`. |
| 33 | +RUN if [ -f "pyproject.toml" ]; then poetry install --only main; \ |
| 34 | + elif [ -f "setup.py" ]; then pip install --upgrade pip && pip install -e .; \ |
| 35 | + elif [ -f "requirements.txt" ]; then pip install --upgrade pip && pip install -r requirements.txt; fi |
| 36 | + |
| 37 | +ENV USE_OCTUE_LOG_HANDLER=1 |
| 38 | +ENV COMPUTE_PROVIDER=GOOGLE_KUEUE |
| 39 | +CMD ["octue", "question", "ask", "local"] |
0 commit comments