Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions pctiler/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
FROM mambaorg/micromamba:1.4.0
COPY --chown=$MAMBA_USER:$MAMBA_USER pctiler/environment.yaml /tmp/env.yaml
FROM ubuntu:latest as build

RUN micromamba install -y -n base -f /tmp/env.yaml && \
micromamba clean --all --yes
# Install Micromamba
RUN apt-get update && apt-get install -y curl bzip2
RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj bin/micromamba

# The devops Personal Access Token for accessing
# Azure Artifacts. Note: This will be visible as
# plain text in the docker build logs. Only use your
# PAT for development containers in your local environment.
# Azure Pipelines will utilize a temporary key for builds
# when building deploy images so that there is not arisk of
# exposure.
ARG DEVOPS_PAT
COPY pctiler/environment.yaml /tmp/env.yaml

EXPOSE 8000
# Create a separate environment for the packages and remove unnecessary files
RUN micromamba create -p /opt/conda/envs/myenv -f /tmp/env.yaml && \
micromamba clean --all --yes && \
rm -rf /root/.cache /tmp/env.yaml

# Start from a new stage to avoid copying the build environment, and
# copy the environment from the build stage
# Remove unnecessary files
RUN find /opt/conda/envs/myenv -type f -name "*.pyc" -exec rm -f {} \;
RUN rm -rf /opt/conda/envs/myenv/share/doc
RUN rm -rf /opt/conda/envs/myenv/share/locale
RUN rm -rf /opt/conda/envs/myenv/man
RUN rm -rf /opt/conda/envs/myenv/include

FROM ubuntu:latest

COPY --from=build /opt/conda/envs/myenv /opt/conda/envs/myenv
ENV PATH="/opt/conda/envs/myenv/bin:$PATH"

WORKDIR /opt/src
ARG MAMBA_DOCKERFILE_ACTIVATE=1

COPY --chown=$MAMBA_USER:$MAMBA_USER pccommon /opt/src/pccommon
COPY --chown=$MAMBA_USER:$MAMBA_USER pctiler /opt/src/pctiler
RUN python3 -m pip install -e ./pccommon -e ./pctiler[server]
COPY pccommon /opt/src/pccommon
COPY pctiler /opt/src/pctiler

# Install the local modules in the new environment
RUN /bin/sh -c "python -m pip install --no-cache-dir -e ./pccommon -e ./pctiler[server]"

# GDAL config
ENV GDAL_CACHEMAX 200
Expand All @@ -47,7 +58,4 @@ ENV MOSAIC_CONCURRENCY 1
ENV APP_HOST=0.0.0.0
ENV APP_PORT=80

# Run uvicorn as root. The build context user is $MAMBA_USER which doesn't have
# permission to bind to port 80.
USER root
CMD uvicorn pctiler.main:app --host ${APP_HOST} --port ${APP_PORT} --log-level info
4 changes: 1 addition & 3 deletions pctiler/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
FROM pc-apis-tiler

ARG MAMBA_DOCKERFILE_ACTIVATE=1

COPY --chown=$MAMBA_USER:$MAMBA_USER requirements-dev.txt requirements-dev.txt
COPY requirements-dev.txt requirements-dev.txt

RUN python3 -m pip install -r requirements-dev.txt
RUN python3 -m pip install -e ./pccommon -e ./pctiler
16 changes: 6 additions & 10 deletions pctiler/environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ dependencies:
- planetary-computer==0.4.9
- geojson-pydantic==0.4.2
# colormap dependencies
- matplotlib==3.4.3
- git
- matplotlib-base==3.4.3
- pip
- pip:
- "titiler.core==0.10.2"
- "titiler.mosaic==0.10.2"
- "titiler.core==0.10.2"
- "titiler.mosaic==0.10.2"

- # titiler-pgstac
- "psycopg[binary,pool]"
- "titiler.pgstac==0.2.2"

# - "importlib_resources>=1.1.0;python_version<'3.9'"
# - "pccommon"
- # titiler-pgstac
- "psycopg[binary,pool]"
- "titiler.pgstac==0.2.2"
23 changes: 2 additions & 21 deletions pctiler/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,8 @@

from setuptools import find_packages, setup

# Runtime requirements.
inst_reqs = [
"geojson-pydantic==0.4.2",
"jinja2==3.0.3",
"pystac==1.*",
"planetary-computer==0.4.*",

"rasterio==1.3.*",
"titiler.core==0.10.2",
"titiler.mosaic==0.10.2",

# titiler-pgstac
"psycopg[binary,pool]",
"titiler.pgstac==0.2.2",

# colormap dependencies
"matplotlib==3.4.*",

"importlib_resources>=1.1.0;python_version<'3.9'",
"pccommon",
]
# Runtime requirements, see environment.yaml
inst_reqs = []

extra_reqs = {
"server": [
Expand Down