Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
57 lines (49 loc) · 2.92 KB
/
Copy pathDockerfile
File metadata and controls
57 lines (49 loc) · 2.92 KB
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
FROM python:3.12.15-slim
WORKDIR /src
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git rsync nodejs npm && \
rm -rf /var/lib/apt/lists/* && \
python -m venv /venv && \
/venv/bin/python -m pip install --upgrade pip && \
git config --global --add safe.directory '*' && \
npm install jsonld && \
git config --system --add safe.directory '*'
# Copied only now so that changing the requirements does not rebuild the (large) system packages layer
COPY requirements-base.txt /
RUN /venv/bin/python -m pip install -r /requirements-base.txt
# Our own packages (ogc-na), in a separate small layer so that bumping them does not rebuild the one above.
# Installing the whole requirements.txt again (instead of only ogc-na) keeps the pins of requirements-base.txt
# in force: anything already installed is kept, and a conflicting new ogc-na fails the build
COPY requirements.txt /
RUN /venv/bin/python -m pip install -r /requirements.txt
# Reference copy of bblocks-template, used to detect outdated scaffolding scripts
# (build.sh, view.sh, ...) in the repo being processed. A full (non-shallow)
# clone is needed to walk the files' full history when building the hash
# manifest below; .git is stripped afterwards so it isn't carried in the image.
# BBP_TEMPLATE_REF is the commit being cloned (when given), so that the layer is rebuilt, rather than
# reused from the cache, when bblocks-template changes. Any ARG changes the cache key of the RUN
# instructions after it, so ARGs are kept below the large, slow layers.
ARG BBP_TEMPLATE_REF=""
COPY scripts/generate_template_hash_manifest.py /tmp/generate_template_hash_manifest.py
COPY ogc/bblocks/tracked_template_files.txt /tmp/tracked_template_files.txt
COPY ogc/bblocks/lineage_template_files.json /tmp/lineage_template_files.json
RUN git clone https://github.com/opengeospatial/bblocks-template.git /opt/bblocks-template && \
if [ -n "$BBP_TEMPLATE_REF" ]; then git -C /opt/bblocks-template checkout --quiet "$BBP_TEMPLATE_REF"; fi && \
/venv/bin/python /tmp/generate_template_hash_manifest.py \
/opt/bblocks-template /opt/bblocks-template/.known-template-hashes.json \
/tmp/tracked_template_files.txt /tmp/lineage_template_files.json && \
rm -rf /opt/bblocks-template/.git /tmp/generate_template_hash_manifest.py \
/tmp/tracked_template_files.txt /tmp/lineage_template_files.json
ENV PYTHONPATH=/src/
ENV PYTHONUNBUFFERED=1
ENV NODE_PATH=/src/node_modules
ENV BBP_GIT_INFO_FILE=/GIT_INFO
ENV BBP_TEMPLATE_DIR=/opt/bblocks-template
COPY ogc/ /src/ogc/
# Commit and date of this build. Declared last on purpose: it changes with every commit, and any ARG
# changes the cache key of the RUN instructions after it, so declaring it earlier would rebuild (and
# make users download again) the large layers above for every release.
ARG BBP_GIT_INFO=""
RUN echo "$BBP_GIT_INFO" > /GIT_INFO
ENTRYPOINT ["/venv/bin/python", "-m", "ogc.bblocks.entrypoint"]