-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
55 lines (43 loc) · 1.87 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
# syntax=docker/dockerfile:1
FROM alpine/git AS ms-tool-src
RUN git clone https://github.com/microsoft/Tools-for-Health-Data-Anonymization.git /app
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS ms-tool
COPY --from=ms-tool-src /app /app
# This will force builds to fail if the environment piping breaks for some reason
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN arch=$(arch | sed s/aarch64/arm64/ | sed s/x86_64/x64/) && \
dotnet publish \
--runtime=linux-${arch} \
--self-contained=true \
--configuration=Release \
-p:InvariantGlobalization=true \
-p:PublishSingleFile=true \
--output=/bin \
/app/FHIR/src/Microsoft.Health.Fhir.Anonymizer.R4.CommandLineTool
FROM python:3.11 AS cumulus-etl-test
COPY --from=eclipse-temurin:17-jre /opt/java/openjdk /opt/java/openjdk
COPY --from=ms-tool /bin/Microsoft.Health.Fhir.Anonymizer.R4.CommandLineTool /bin
COPY . /app
RUN --mount=type=cache,target=/root/.cache \
pip3 install /app/[tests]
RUN rm -r /app
ENV JAVA_HOME=/opt/java/openjdk
ENTRYPOINT ["cumulus-etl"]
FROM python:3.11 AS cumulus-etl
COPY --from=eclipse-temurin:17-jre /opt/java/openjdk /opt/java/openjdk
COPY --from=ms-tool /bin/Microsoft.Health.Fhir.Anonymizer.R4.CommandLineTool /bin
# Ship pre-downloaded nltk files, used by philter
RUN pip3 install nltk
RUN python3 -m nltk.downloader -d /usr/local/share/nltk_data averaged_perceptron_tagger
COPY . /app
# A local version is the trailing bit of a Python version after a plus sign, like 5.0+ubuntu1.
# We use it here mostly to inject a git commit sha when building from git.
ARG LOCAL_VERSION
RUN [ -z "$LOCAL_VERSION" ] || sed -i "s/\(__version__.*\)\"/\1+$LOCAL_VERSION\"/" /app/cumulus_etl/__init__.py
# Print the final version we're using
RUN grep __version__ /app/cumulus_etl/__init__.py
RUN --mount=type=cache,target=/root/.cache \
pip3 install /app
RUN rm -r /app
ENV JAVA_HOME=/opt/java/openjdk
ENTRYPOINT ["cumulus-etl"]