ihdelta-datasette / Dockerfile
Nicky Nicolson
Strip test secret, unzip artifact
fab3ed6
# syntax = docker/dockerfile:1.2
FROM python:3.11
ARG IHDELTA_DB_ARTIFACT_URL=$IHDELTA_DB_ARTIFACT_URL
# ARG GH_TOKEN=$GH_TOKEN
# RUN apt update && apt install -y \
# curl \
# gpg
# RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg;
# RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null;
# # RUN apt update && apt install -y gh;
# # RUN gh --help
# RUN apt install -y jq
# RUN jq --help
# # RUN echo ${GH_TOKEN} > mytoken.txt
# # RUN ls -l mytoken.txt
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY ./downloadartifact.py /code
RUN --mount=type=secret,id=GH_TOKEN,mode=0444,required=true \
python /code/downloadartifact.py ${IHDELTA_DB_ARTIFACT_URL} /run/secrets/GH_TOKEN /code/ihdelta.db.zip
RUN ls -l /code
RUN unzip /code/ihdelta.db.zip -d /code
RUN ls -l /code
# Download ID is set as a space variable
# By default it is a download of all Solanum preserved specimen records (c600K)
# Get ihdelta sqlite db
# ADD https://drive.google.com/uc?export=download&id=1on1yWtPihmWSmuMqmEl1blV2fQVtxI62 /code/ihdelta.db
RUN sqlite-utils tables /code/ihdelta.db --counts
RUN chmod 755 /code/ihdelta.db
# Create datasette metadata file
COPY ./metadata.json /code/metadata.json
CMD ["datasette", "/code/ihdelta.db", "-m", "/code/metadata.json", "--host", "0.0.0.0", "--port", "7860", "--setting", "sql_time_limit_ms", "3500"]