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
12 changes: 12 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.git
.github
.venv
__pycache__
*.pyc
.pytest_cache
.mypy_cache
.ruff_cache
somef_outputs
pitfalls_outputs
analysis_results.json
.env
27 changes: 27 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Optional API tokens. Leave blank to skip a provider.
# Example: github_pat_xxxxxxxxxxxxxxxxxxxx
GITHUB_API_TOKEN=
# Example: glpat-xxxxxxxxxxxxxxxxxxxx
GITLAB_API_TOKEN=
# Example: xxxxxxxxxxxxxxxxxxxx
CODEBERG_TOKEN=
# Example: ATBBxxxxxxxxxxxxxxxxxxxx
BITBUCKET_API_TOKEN=
# Example: user@example.org
BITBUCKET_EMAIL=

# Classifier model files. Leave blank to use the models installed with somef.
# Example: /usr/local/lib/python3.11/site-packages/somef/models/description.p
SOMEF_DESCRIPTION_MODEL=
# Example: /usr/local/lib/python3.11/site-packages/somef/models/invocation.p
SOMEF_INVOCATION_MODEL=
# Example: /usr/local/lib/python3.11/site-packages/somef/models/installation.p
SOMEF_INSTALLATION_MODEL=
# Example: /usr/local/lib/python3.11/site-packages/somef/models/citation.p
SOMEF_CITATION_MODEL=

# RDF/base metadata configuration.
# Example: https://w3id.org/okn/i/
SOMEF_BASE_URI=
# Example: 1000
SOMEF_DOWNLOAD_LIMIT_MB=1000
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ poetry.lock
.env
.env.*
*.env
!.env.example

# Logs
*.log
Expand Down Expand Up @@ -139,4 +140,4 @@ uv.lock
results_*/

# Backup directory
BACKUP/
BACKUP/
39 changes: 39 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM python:3.11-slim

# Runtime defaults: no Poetry venv, non-interactive installs, and SoMEF config values.
ENV PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_NO_INTERACTION=1 \
DEBIAN_FRONTEND=noninteractive \
NLTK_DATA=/usr/local/share/nltk_data \
SOMEF_CONFIGURATION_FILE=/root/.somef/config.json \
SOMEF_BASE_URI=https://w3id.org/okn/i/ \
SOMEF_DOWNLOAD_LIMIT_MB=1000

WORKDIR /app

# System packages needed to install Python packages with native extensions and clone repos.
RUN apt-get update \
&& apt-get install -y --no-install-recommends build-essential git \
&& rm -rf /var/lib/apt/lists/*

# Install Poetry globally; dependencies will still go into the container Python.
RUN pip install poetry

# Install project dependencies first to keep Docker layer caching useful.
COPY pyproject.toml poetry.lock ./
RUN poetry install --only main --no-root --no-ansi

# Pre-download NLTK resources used by SoMEF so runtime does not configure interactively.
RUN python -m nltk.downloader -d /usr/local/share/nltk_data \
wordnet omw-1.4 punkt punkt_tab stopwords

# Copy the application and install only the rsmetacheck package itself.
COPY . .
RUN poetry install --only-root --no-ansi \
&& chmod +x /app/docker-somef-config.sh

# Configure SoMEF from environment variables, then run rsmetacheck through Poetry.
ENTRYPOINT ["/app/docker-somef-config.sh"]
CMD ["rsmetacheck", "--help"]
19 changes: 19 additions & 0 deletions docker-somef-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
set -e

echo "configuring somef..."
printf "%s\n" \
"${GITHUB_API_TOKEN:-}" \
"${GITLAB_API_TOKEN:-}" \
"${CODEBERG_TOKEN:-}" \
"${BITBUCKET_API_TOKEN:-}" \
"${BITBUCKET_EMAIL:-}" \
"${SOMEF_DESCRIPTION_MODEL:-}" \
"${SOMEF_INVOCATION_MODEL:-}" \
"${SOMEF_INSTALLATION_MODEL:-}" \
"${SOMEF_CITATION_MODEL:-}" \
"${SOMEF_BASE_URI:-}" \
"${SOMEF_DOWNLOAD_LIMIT_MB:-1000}" \
| somef configure

exec "$@"
Loading