File size: 1,450 Bytes
707b5cb
 
 
fe71289
e9745bf
 
 
 
 
707b5cb
fe71289
707b5cb
 
 
 
2a908ed
707b5cb
 
2a908ed
707b5cb
e9745bf
707b5cb
 
fe71289
707b5cb
 
 
 
 
 
 
 
e9745bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# DEPTH Risk Map -- Hugging Face Docker Space
# Base ships R + sf/GDAL/GEOS/PROJ (the slowest deps to build).
FROM rocker/geospatial:4.4

# DuckDB lives on the edgarodriguez/depth_alpha dataset (public); baked in at
# build. Override with: docker build --build-arg DDB_URL=... -t depth-hf .
# If the dataset is ever made PRIVATE, add a build secret instead of an ARG:
#   RUN --mount=type=secret,id=hf_token curl -H "Authorization: Bearer \
#       $(cat /run/secrets/hf_token)" -fL "${DDB_URL}" -o /app/depth_mexico.duckdb
ARG DDB_URL=https://huggingface.co/datasets/edgarodriguez/depth_alpha/resolve/main/depth_mexico.duckdb

RUN install2.r --error --skipinstalled \
      shiny bslib DBI duckdb dplyr jsonlite htmltools glue writexl ggplot2 stringr \
 && R -e "install.packages('mapgl', repos = c('https://walkerke.r-universe.dev', 'https://cloud.r-project.org'))" \
 && R -e "library(mapgl); library(duckdb); library(sf); library(shiny)"

WORKDIR /app
COPY 10.11_draw_query_indicators_v10_HF.R helpers.R 10.08_styles.css ./

# Bake the DuckDB into the image (build-time download).
RUN curl -fL "${DDB_URL}" -o /app/depth_mexico.duckdb \
 && test -s /app/depth_mexico.duckdb \
 && ls -lh /app/depth_mexico.duckdb

# HF Spaces runs the container as a non-root user -- make /app world-readable.
RUN chmod -R a+rX /app

ENV DEPTH_DDB_PATH=/app/depth_mexico.duckdb \
    PORT=7860

EXPOSE 7860
CMD ["Rscript", "10.11_draw_query_indicators_v10_HF.R"]