Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
91 lines (74 loc) · 2.83 KB
/
Copy pathDockerfile
File metadata and controls
91 lines (74 loc) · 2.83 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Use bookworm as a base
FROM python:3.14-bookworm
# get build arguments
ARG BUILD_TIME
ARG BRANCH
# Defaulted so a plain "docker build ." still produces a working image, marked
# as the non-release it is rather than borrowing the last real version number.
ARG VERSION=0.0.0.dev0+unknown
ARG GITVERSION
ARG GITSHA
ARG GITDATE
# set and echo environment variables
ENV BUILD_TIME=$BUILD_TIME
ENV BRANCH=$BRANCH
ENV GITVERSION=${GITVERSION}
ENV GITSHA=${GITSHA}
ENV GITDATE=${GITDATE}
RUN echo "BRANCH: "$BRANCH
RUN echo "BUILD_TIME: "$BUILD_TIME
RUN echo "GITVERSION: "$GITVERSION
RUN echo "GITSHA: "$GITSHA
RUN echo "GITDATE: "$GITDATE
# set the shell to bash
SHELL [ "/bin/bash", "--login", "-c" ]
# Prepare the unix environment
ARG DEBIAN_FRONTEND=noninteractive
ENV TZ=America/New_York
RUN apt-get update --fix-missing && \
apt update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends tzdata && \
apt-get install -y --no-install-recommends cgroup-tools && \
apt-get install -y --no-install-recommends tesseract-ocr && \
apt-get install -y --no-install-recommends epiphany-browser
# Pull in the newest versions of packages to address any security issues
RUN apt-get dist-upgrade -y
# Clean up
RUN apt-get autoremove
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip)
ENV PATH="/root/.local/bin:$PATH" \
LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
PYTHONNOUSERSITE=1
# install uv to make installations faster
RUN pip install uv
# Copy protoparser into container
COPY . /src/protoparser
# The version comes from the git tag, but .git is excluded from the build
# context (it is 5 MB of history the image has no use for), so setuptools-scm
# has nothing to read here. Hand it the version the build was invoked with
# instead; without this the image would silently report 0.1.dev0 no matter
# which release it was built from.
ENV SETUPTOOLS_SCM_PRETEND_VERSION_FOR_SIEMENS_PROTOCOL=${VERSION}
# Install the package with the OCR extra. tesseract-ocr above is the native
# binary; the extra is the Python side (pytesseract, pillow). Both are needed
# for --ocr always, and neither implies the other.
RUN cd /src/protoparser && \
uv tool install ".[ocr]"
RUN chmod -R a+r /src/protoparser
# clean up
RUN pip cache purge
RUN uv cache clean
ENV RUNNING_IN_CONTAINER=1
RUN cd /root; TZ=GMT date "+%Y-%m-%d %H:%M:%S" > buildtime
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="protoparser" \
org.label-schema.description="Tools for manipulating Siemens PDF MR protocol files" \
org.label-schema.url="http://nirs-fmri.net" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/bbfrederick/protoparser" \
org.label-schema.version=$VERSION