[refactor] remove unused Dockerfile, try installing sphinx with requirements.txt in cloudflare pages ci
Browse files- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +7 -0
- .idea/vcs.xml +6 -0
- Dockerfile +0 -46
- README.md +1 -1
- dockerfiles/dockerfile-fastapi-samgeo +3 -3
- dockerfiles/dockerfile-lambda-gdal-runner +3 -3
- requirements.txt +2 -13
- requirements_dockerfile.txt +13 -0
- requirements_docs.txt +0 -2
.idea/inspectionProfiles/profiles_settings.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<component name="InspectionProjectProfileManager">
|
| 2 |
+
<settings>
|
| 3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
| 4 |
+
<version value="1.0" />
|
| 5 |
+
</settings>
|
| 6 |
+
</component>
|
.idea/misc.xml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="Black">
|
| 4 |
+
<option name="sdkName" value="Python 3.11 (samgis)" />
|
| 5 |
+
</component>
|
| 6 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Pipenv (samgis)" project-jdk-type="Python SDK" />
|
| 7 |
+
</project>
|
.idea/vcs.xml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
+
<project version="4">
|
| 3 |
+
<component name="VcsDirectoryMappings">
|
| 4 |
+
<mapping directory="" vcs="Git" />
|
| 5 |
+
</component>
|
| 6 |
+
</project>
|
Dockerfile
DELETED
|
@@ -1,46 +0,0 @@
|
|
| 1 |
-
# inspired by https://dev.to/gaborschulz/running-python-311-on-aws-lambda-1i7p
|
| 2 |
-
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.7.2 as build-image
|
| 3 |
-
|
| 4 |
-
LABEL maintainer="alessandro trinca <[email protected]>"
|
| 5 |
-
|
| 6 |
-
# Include global arg in this stage of the build
|
| 7 |
-
ARG LAMBDA_TASK_ROOT="/var/task"
|
| 8 |
-
ARG PYTHONPATH="${LAMBDA_TASK_ROOT}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages"
|
| 9 |
-
|
| 10 |
-
RUN mkdir -p ${LAMBDA_TASK_ROOT}
|
| 11 |
-
|
| 12 |
-
# Install aws-lambda-cpp build dependencies
|
| 13 |
-
RUN apt update && \
|
| 14 |
-
apt install -y g++ make cmake unzip libcurl4-openssl-dev python3-pip
|
| 15 |
-
|
| 16 |
-
# install required packages
|
| 17 |
-
COPY requirements_pip.txt ${LAMBDA_TASK_ROOT}/
|
| 18 |
-
RUN python -m pip install --target ${LAMBDA_TASK_ROOT} --upgrade -r ${LAMBDA_TASK_ROOT}/requirements_pip.txt
|
| 19 |
-
RUN python -m pip install torch torchvision --target ${LAMBDA_TASK_ROOT} --index-url https://download.pytorch.org/whl/cpu
|
| 20 |
-
COPY requirements.txt ${LAMBDA_TASK_ROOT}/
|
| 21 |
-
RUN python -m pip install --target ${LAMBDA_TASK_ROOT} -r ${LAMBDA_TASK_ROOT}/requirements.txt
|
| 22 |
-
|
| 23 |
-
FROM osgeo/gdal:ubuntu-small-3.7.2
|
| 24 |
-
|
| 25 |
-
# Include global arg in this stage of the build
|
| 26 |
-
ARG LAMBDA_TASK_ROOT="/var/task"
|
| 27 |
-
ARG PYTHONPATH="${LAMBDA_TASK_ROOT}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages"
|
| 28 |
-
ARG RIE="https://github.com/aws/aws-lambda-runtime-interface-emulator/releases/latest/download/aws-lambda-rie"
|
| 29 |
-
|
| 30 |
-
# Set working directory to function root directory
|
| 31 |
-
WORKDIR ${LAMBDA_TASK_ROOT}
|
| 32 |
-
|
| 33 |
-
RUN apt update && apt install -y libgl1 curl
|
| 34 |
-
RUN ls -ld /usr/lib/x86_64-linux-gnu/libGL.so* || echo "libGL.so* not found..."
|
| 35 |
-
|
| 36 |
-
# Copy in the built dependencies
|
| 37 |
-
COPY --from=build-image ${LAMBDA_TASK_ROOT} ${LAMBDA_TASK_ROOT}
|
| 38 |
-
|
| 39 |
-
RUN curl -Lo /usr/local/bin/aws-lambda-rie ${RIE}
|
| 40 |
-
RUN chmod +x /usr/local/bin/aws-lambda-rie
|
| 41 |
-
|
| 42 |
-
COPY ./scripts/lambda-entrypoint.sh /lambda-entrypoint.sh
|
| 43 |
-
RUN chmod +x /lambda-entrypoint.sh
|
| 44 |
-
RUN ls -l /lambda-entrypoint.sh
|
| 45 |
-
|
| 46 |
-
ENTRYPOINT ["/lambda-entrypoint.sh"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -57,7 +57,7 @@ curl -X 'POST' \
|
|
| 57 |
|
| 58 |
|
| 59 |
## Dependencies installation and local tests
|
| 60 |
-
The docker build process needs only the classic requirements.txt, instead for local development and sphinx-docs build
|
| 61 |
there is `Pipfile` (sphinx docs is hosted on Cloudflare Pages).
|
| 62 |
|
| 63 |
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
## Dependencies installation and local tests
|
| 60 |
+
The docker build process needs only the classic requirements.txt (here renamed to `requirements_dockerfile.txt`), instead for local development and sphinx-docs build
|
| 61 |
there is `Pipfile` (sphinx docs is hosted on Cloudflare Pages).
|
| 62 |
|
| 63 |
|
dockerfiles/dockerfile-fastapi-samgeo
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.7.2
|
| 2 |
|
| 3 |
WORKDIR /code
|
| 4 |
-
COPY ./
|
| 5 |
COPY ./requirements_pip.txt /code/requirements_pip.txt
|
| 6 |
|
| 7 |
RUN apt update && apt install -y g++ make cmake unzip libcurl4-openssl-dev python3-pip
|
|
@@ -14,7 +14,7 @@ RUN which python
|
|
| 14 |
RUN python --version
|
| 15 |
RUN python -m pip install --no-cache-dir --upgrade -r /code/requirements_pip.txt
|
| 16 |
RUN python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
| 17 |
-
RUN python -m pip install --no-cache-dir -r /code/
|
| 18 |
|
| 19 |
RUN useradd -m -u 1000 user
|
| 20 |
|
|
@@ -35,4 +35,4 @@ RUN echo $HOME/
|
|
| 35 |
RUN ls -l $HOME/app
|
| 36 |
RUN ls -l $HOME/
|
| 37 |
|
| 38 |
-
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
FROM ghcr.io/osgeo/gdal:ubuntu-small-3.7.2
|
| 2 |
|
| 3 |
WORKDIR /code
|
| 4 |
+
COPY ./requirements_dockerfile.txt /code/requirements_dockerfile.txt
|
| 5 |
COPY ./requirements_pip.txt /code/requirements_pip.txt
|
| 6 |
|
| 7 |
RUN apt update && apt install -y g++ make cmake unzip libcurl4-openssl-dev python3-pip
|
|
|
|
| 14 |
RUN python --version
|
| 15 |
RUN python -m pip install --no-cache-dir --upgrade -r /code/requirements_pip.txt
|
| 16 |
RUN python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
| 17 |
+
RUN python -m pip install --no-cache-dir -r /code/requirements_dockerfile.txt
|
| 18 |
|
| 19 |
RUN useradd -m -u 1000 user
|
| 20 |
|
|
|
|
| 35 |
RUN ls -l $HOME/app
|
| 36 |
RUN ls -l $HOME/
|
| 37 |
|
| 38 |
+
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
dockerfiles/dockerfile-lambda-gdal-runner
CHANGED
|
@@ -10,15 +10,15 @@ RUN echo "ENV RIE: $RIE ..."
|
|
| 10 |
# Set working directory to function root directory
|
| 11 |
WORKDIR ${LAMBDA_TASK_ROOT}
|
| 12 |
COPY requirements_pip.txt ${LAMBDA_TASK_ROOT}/requirements_pip.txt
|
| 13 |
-
COPY
|
| 14 |
|
| 15 |
# avoid segment-geospatial exception caused by missing libGL.so.1 library
|
| 16 |
-
RUN apt update && apt install -y libgl1 curl python3-pip
|
| 17 |
RUN ls -ld /usr/lib/*linux-gnu/libGL.so* || echo "libGL.so* not found..."
|
| 18 |
RUN which python
|
| 19 |
RUN python --version
|
| 20 |
RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements_pip.txt --upgrade --target ${LAMBDA_TASK_ROOT}
|
| 21 |
-
RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/
|
| 22 |
RUN python -c "import sys;print(sys.path)"
|
| 23 |
# RUN python -m pip install pillow awslambdaric aws-lambda-powertools httpx jmespath --target ${LAMBDA_TASK_ROOT}
|
| 24 |
|
|
|
|
| 10 |
# Set working directory to function root directory
|
| 11 |
WORKDIR ${LAMBDA_TASK_ROOT}
|
| 12 |
COPY requirements_pip.txt ${LAMBDA_TASK_ROOT}/requirements_pip.txt
|
| 13 |
+
COPY requirements_dockerfile.txt ${LAMBDA_TASK_ROOT}/requirements_dockerfile.txt
|
| 14 |
|
| 15 |
# avoid segment-geospatial exception caused by missing libGL.so.1 library
|
| 16 |
+
RUN apt update && apt install -y libgl1 curl python3-pip && apt clean
|
| 17 |
RUN ls -ld /usr/lib/*linux-gnu/libGL.so* || echo "libGL.so* not found..."
|
| 18 |
RUN which python
|
| 19 |
RUN python --version
|
| 20 |
RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements_pip.txt --upgrade --target ${LAMBDA_TASK_ROOT}
|
| 21 |
+
RUN python -m pip install -r ${LAMBDA_TASK_ROOT}/requirements_dockerfile.txt --target ${LAMBDA_TASK_ROOT}
|
| 22 |
RUN python -c "import sys;print(sys.path)"
|
| 23 |
# RUN python -m pip install pillow awslambdaric aws-lambda-powertools httpx jmespath --target ${LAMBDA_TASK_ROOT}
|
| 24 |
|
requirements.txt
CHANGED
|
@@ -1,13 +1,2 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
bson
|
| 4 |
-
geopandas
|
| 5 |
-
jmespath
|
| 6 |
-
numpy
|
| 7 |
-
onnxruntime
|
| 8 |
-
opencv-python-headless
|
| 9 |
-
pillow
|
| 10 |
-
pydantic>=2.0.3
|
| 11 |
-
python-dotenv
|
| 12 |
-
rasterio
|
| 13 |
-
requests
|
|
|
|
| 1 |
+
sphinx
|
| 2 |
+
sphinx-autodoc-typehints
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements_dockerfile.txt
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aws-lambda-powertools
|
| 2 |
+
awslambdaric
|
| 3 |
+
bson
|
| 4 |
+
geopandas
|
| 5 |
+
jmespath
|
| 6 |
+
numpy
|
| 7 |
+
onnxruntime
|
| 8 |
+
opencv-python-headless
|
| 9 |
+
pillow
|
| 10 |
+
pydantic>=2.0.3
|
| 11 |
+
python-dotenv
|
| 12 |
+
rasterio
|
| 13 |
+
requests
|
requirements_docs.txt
DELETED
|
@@ -1,2 +0,0 @@
|
|
| 1 |
-
sphinx
|
| 2 |
-
sphinx-autodoc-typehints
|
|
|
|
|
|
|
|
|