alessandro trinca tornidor commited on
Commit
7650159
1 Parent(s): 0fdaf4f

[feat] Dockerfile, dockerfile-lisa-base: try using ENV XDG_CACHE_HOME, prepare persistent storage on huggingface

Browse files
Dockerfile CHANGED
@@ -1,7 +1,8 @@
1
  # Include global ARGs at the dockerfile top
2
  ARG ARCH="x86_64"
3
  ARG LAMBDA_TASK_ROOT="/var/task"
4
- ARG FASTAPI_STATIC="${LAMBDA_TASK_ROOT}/static"
 
5
  ARG PYTHONPATH="${LAMBDA_TASK_ROOT}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages"
6
  ARG POETRY_NO_INTERACTION=1
7
  ARG POETRY_VIRTUALENVS_IN_PROJECT=1
@@ -83,6 +84,8 @@ COPY --from=builder_global ${LAMBDA_TASK_ROOT}/.venv ${LAMBDA_TASK_ROOT}/.venv
83
  RUN echo "new LAMBDA_TASK_ROOT after hidden venv copy => ${LAMBDA_TASK_ROOT}"
84
  RUN ls -ld ${LAMBDA_TASK_ROOT}/
85
  RUN ls -lA ${LAMBDA_TASK_ROOT}/
 
 
86
 
87
 
88
  ### conditional section
@@ -169,8 +172,8 @@ RUN python -c "import uvicorn"
169
  RUN df -h
170
  RUN ls -l ${LAMBDA_TASK_ROOT}/samgis/
171
  RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
172
- RUN ls -l ${LAMBDA_TASK_ROOT}/static/
173
- RUN ls -l ${LAMBDA_TASK_ROOT}/static/dist
174
- RUN ls -l ${LAMBDA_TASK_ROOT}/static/node_modules
175
 
176
  CMD ["uvicorn", "wrappers.fastapi_wrapper:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Include global ARGs at the dockerfile top
2
  ARG ARCH="x86_64"
3
  ARG LAMBDA_TASK_ROOT="/var/task"
4
+ ENV XDG_CACHE_HOME="/data"
5
+ ARG FASTAPI_STATIC="${XDG_CACHE_HOME}/static"
6
  ARG PYTHONPATH="${LAMBDA_TASK_ROOT}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages"
7
  ARG POETRY_NO_INTERACTION=1
8
  ARG POETRY_VIRTUALENVS_IN_PROJECT=1
 
84
  RUN echo "new LAMBDA_TASK_ROOT after hidden venv copy => ${LAMBDA_TASK_ROOT}"
85
  RUN ls -ld ${LAMBDA_TASK_ROOT}/
86
  RUN ls -lA ${LAMBDA_TASK_ROOT}/
87
+ RUN ls -ld ${LAMBDA_TASK_ROOT}/.venv
88
+ RUN ls -lA ${LAMBDA_TASK_ROOT}/.venv
89
 
90
 
91
  ### conditional section
 
172
  RUN df -h
173
  RUN ls -l ${LAMBDA_TASK_ROOT}/samgis/
174
  RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
175
+ RUN ls -l ${FASTAPI_STATIC}/
176
+ RUN ls -l ${FASTAPI_STATIC}/dist
177
+ RUN ls -l ${FASTAPI_STATIC}/node_modules
178
 
179
  CMD ["uvicorn", "wrappers.fastapi_wrapper:app", "--host", "0.0.0.0", "--port", "7860"]
dockerfiles/dockerfile-lisa-base CHANGED
@@ -1,12 +1,14 @@
1
  # Include global ARGs at the dockerfile top
2
  ARG ARCH="x86_64"
3
  ARG LAMBDA_TASK_ROOT="/var/task"
4
- ARG FASTAPI_STATIC="${LAMBDA_TASK_ROOT}/static"
 
5
  ARG PYTHONPATH="${LAMBDA_TASK_ROOT}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages"
6
  ARG POETRY_NO_INTERACTION=1
7
  ARG POETRY_VIRTUALENVS_IN_PROJECT=1
8
  ARG POETRY_VIRTUALENVS_CREATE=1
9
  ARG POETRY_CACHE_DIR=/tmp/poetry_cache
 
10
 
11
 
12
  FROM nvcr.io/nvidia/pytorch:24.01-py3 as builder_global
@@ -82,6 +84,8 @@ COPY --from=builder_global ${LAMBDA_TASK_ROOT}/.venv ${LAMBDA_TASK_ROOT}/.venv
82
  RUN echo "new LAMBDA_TASK_ROOT after hidden venv copy => ${LAMBDA_TASK_ROOT}"
83
  RUN ls -ld ${LAMBDA_TASK_ROOT}/
84
  RUN ls -lA ${LAMBDA_TASK_ROOT}/
 
 
85
 
86
 
87
  ### conditional section
 
1
  # Include global ARGs at the dockerfile top
2
  ARG ARCH="x86_64"
3
  ARG LAMBDA_TASK_ROOT="/var/task"
4
+ ENV XDG_CACHE_HOME="/data"
5
+ ARG FASTAPI_STATIC="${XDG_CACHE_HOME}/static"
6
  ARG PYTHONPATH="${LAMBDA_TASK_ROOT}:${PYTHONPATH}:/usr/local/lib/python3/dist-packages"
7
  ARG POETRY_NO_INTERACTION=1
8
  ARG POETRY_VIRTUALENVS_IN_PROJECT=1
9
  ARG POETRY_VIRTUALENVS_CREATE=1
10
  ARG POETRY_CACHE_DIR=/tmp/poetry_cache
11
+ ARG DEPENDENCY_GROUP=fastapi
12
 
13
 
14
  FROM nvcr.io/nvidia/pytorch:24.01-py3 as builder_global
 
84
  RUN echo "new LAMBDA_TASK_ROOT after hidden venv copy => ${LAMBDA_TASK_ROOT}"
85
  RUN ls -ld ${LAMBDA_TASK_ROOT}/
86
  RUN ls -lA ${LAMBDA_TASK_ROOT}/
87
+ RUN ls -ld ${LAMBDA_TASK_ROOT}/.venv
88
+ RUN ls -lA ${LAMBDA_TASK_ROOT}/.venv
89
 
90
 
91
  ### conditional section
dockerfiles/dockerfile-lisa-predictions CHANGED
@@ -1,4 +1,4 @@
1
- FROM registry.gitlab.com/aletrn/gis-lisa-base:1.2.2
2
 
3
  # Include global arg in this stage of the build
4
  ARG LAMBDA_TASK_ROOT="/var/task"
@@ -10,11 +10,6 @@ ENV IS_AWS_LAMBDA=""
10
  # Set working directory to function root directory
11
  WORKDIR ${LAMBDA_TASK_ROOT}
12
 
13
- ADD https://github.com/AkihiroSuda/clone3-workaround/releases/download/v1.0.0/clone3-workaround.x86_64 /clone3-workaround
14
- RUN chmod 755 /clone3-workaround
15
- SHELL ["/clone3-workaround","/bin/sh", "-c"]
16
-
17
- COPY scripts ${LAMBDA_TASK_ROOT}/scripts
18
  COPY samgis ${LAMBDA_TASK_ROOT}/samgis
19
  COPY wrappers ${LAMBDA_TASK_ROOT}/wrappers
20
 
@@ -38,8 +33,8 @@ RUN python -c "import uvicorn"
38
  RUN df -h
39
  RUN ls -l ${LAMBDA_TASK_ROOT}/samgis/
40
  RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
41
- RUN ls -l ${LAMBDA_TASK_ROOT}/static/
42
- RUN ls -l ${LAMBDA_TASK_ROOT}/static/dist
43
- RUN ls -l ${LAMBDA_TASK_ROOT}/static/node_modules
44
 
45
  CMD ["uvicorn", "wrappers.fastapi_wrapper:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ FROM registry.gitlab.com/aletrn/gis-lisa-base:1.2.3
2
 
3
  # Include global arg in this stage of the build
4
  ARG LAMBDA_TASK_ROOT="/var/task"
 
10
  # Set working directory to function root directory
11
  WORKDIR ${LAMBDA_TASK_ROOT}
12
 
 
 
 
 
 
13
  COPY samgis ${LAMBDA_TASK_ROOT}/samgis
14
  COPY wrappers ${LAMBDA_TASK_ROOT}/wrappers
15
 
 
33
  RUN df -h
34
  RUN ls -l ${LAMBDA_TASK_ROOT}/samgis/
35
  RUN ls -l ${LAMBDA_TASK_ROOT}/wrappers/
36
+ RUN ls -l ${FASTAPI_STATIC}/
37
+ RUN ls -l ${FASTAPI_STATIC}/dist
38
+ RUN ls -l ${FASTAPI_STATIC}/node_modules
39
 
40
  CMD ["uvicorn", "wrappers.fastapi_wrapper:app", "--host", "0.0.0.0", "--port", "7860"]