-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
71 lines (55 loc) · 1.96 KB
/
Dockerfile
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
FROM python:3.11-slim
##############################
# Setup import cronjob #
##############################
# cron defaults
ENV IMPORT_DEFAULT_GID="9001" \
IMPORT_DEFAULT_UID="9001" \
TIMEZONE="CET" \
DEFAULT_SCHEDULE="00 01 * * *" \
CRONTAB="/var/spool/cron/crontabs/import"
# install cron and utilities
RUN apt-get update && apt-get install --yes --no-install-recommends \
cron \
bash \
gzip \
tzdata \
nano \
git \
&& rm -rf /var/cache/apk/*
# Set up non-root user.
RUN addgroup --gid "$IMPORT_DEFAULT_GID" import \
&& adduser --no-create-home --disabled-password --disabled-login --ingroup import --shell /bin/bash --uid $IMPORT_DEFAULT_UID --gecos "" import
##############################
# Setup import script #
##############################
# Copy cron files.
RUN mkdir /app
COPY import.sh /app/
COPY start.sh /app/
# Make sure scripts are executable
RUN chown import:import /app/*.sh && chmod 774 /app/*.sh
##############################
# Setup Python packages #
##############################
RUN python3 -m pip install --no-cache-dir --upgrade pip setuptools
# Install wikibaseintegrator from source
RUN git clone https://github.com/LeMyst/WikibaseIntegrator.git \
&& pip install ./WikibaseIntegrator
# Install MaRDI client
RUN git clone https://github.com/MaRDI4NFDI/mardiclient.git \
&& pip install ./mardiclient
# Install MaRDI importer
COPY /mardi_importer /mardi_importer
RUN pip install --no-cache-dir -v --no-build-isolation -e /mardi_importer
# Add contentmath datatype to WikibaseIntegrator
COPY config/contentmath.py /usr/local/lib/python3.11/site-packages/wikibaseintegrator/datatypes/
RUN echo "from .contentmath import ContentMath" \
>> /usr/local/lib/python3.11/site-packages/wikibaseintegrator/datatypes/__init__.py
# Copy the unit tests to the image
# COPY tests /tests
# Copy configurations to the image
COPY config /config
# entry point start cronjob
WORKDIR /app
ENTRYPOINT ["/bin/bash","/app/start.sh"]