-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.cleaned2rdf
49 lines (37 loc) · 1.88 KB
/
Dockerfile.cleaned2rdf
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
FROM python:3.9-slim AS build
# Install required packages for building
RUN apt update && \
apt install build-essential python3-dev default-libmysqlclient-dev -y
# Copy source code for building
COPY ./LinksProject/src/main/python/hsn_links_db.py /app/
COPY ./LinksProject/src/main/python/clariah/cleaned2rdf/cleaned2rdf.py /app/
COPY ./docker/cleaned2rdf/ /app
WORKDIR /app
# Setup the virtual environment
RUN pip install --no-cache-dir virtualenv && \
virtualenv venv
ENV PATH "/app/venv/bin:$PATH"
# Install dependencies
RUN pip install --no-cache-dir -r /app/requirements.txt
FROM python:3.9-slim
# Install envsubst tool for adding env variables to config file and the MySQL client libraries
RUN apt update && \
apt install gettext-base default-mysql-client -y && \
apt clean && \
rm -rf /var/lib/apt/lists/*
# Copy the application from the builder
COPY --from=build /app /app
ENV PATH "/app/venv/bin:$PATH"
WORKDIR /app
# Define default values for the env variables
ENV MYSQL_LINKS_HOSTURL mysql_links
ENV MYSQL_LINKS_USERNAME root
ENV MYSQL_LINKS_PASSWORD rootroot
ENV REGISTRATION_FIELDS "id_registration, id_source, id_persist_registration, id_orig_registration, registration_maintype, registration_type, registration_location_no, registration_day, registration_month, registration_year, registration_seq, not_linksbase"
ENV PERSON_FIELDS_COMMON "id_person, id_registration, id_source, registration_maintype, registration_type, firstname, prefix, familyname, sex, role, occupation, age_day, age_month, age_year"
ENV PERSON_FIELDS_BIRTH "birth_day, birth_month, birth_year, birth_location"
ENV PERSON_FIELDS_MARRIAGE "mar_day, mar_month, mar_year, mar_location"
ENV PERSON_FIELDS_DEATH "death_day, death_month, death_year, death_location"
ENV RDF_MERGE_SAMPLES None
# Run envsubst to create YAML files and start the Python script; RDF export in /app/rdf
ENTRYPOINT ["/app/entrypoint.sh"]