-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathDockerfile
More file actions
139 lines (122 loc) · 5.49 KB
/
Dockerfile
File metadata and controls
139 lines (122 loc) · 5.49 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
###################
# Base Container #
###################
ARG PYTHON_VERSION
FROM python:${PYTHON_VERSION}-slim-bookworm AS base
# Install system dependencies
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libpng-dev \
libjpeg-dev \
libjpeg62-turbo-dev \
libfreetype6-dev \
libxft-dev \
libffi-dev \
wget \
gettext \
# postgres packages for psycopg2
libpq-dev \
# curl and ssl for pycurl
libcurl4-openssl-dev \
libssl-dev \
# for python-magic
libmagic1 \
# openslide and vips for image imports with panimg
# gcc is required to compile the extensions
libopenslide-dev \
libvips-dev \
gcc \
# ruby3.1, rugged and nokogiri for licensee
ruby3.1 \
ruby-rugged \
ruby-nokogiri \
# git for CodeBuild integration
git \
# for dbshell \
postgresql-client \
&& rm -rf /var/lib/apt/lists/*
# Fetch and install licensee for checking licenses
# Separate install required as the bundled version does not include the --json flag
RUN gem install licensee -v 9.16.1
# Fetch and install crane for pushing containers
RUN mkdir -p /opt/crane \
&& wget https://github.com/google/go-containerregistry/releases/download/v0.19.0/go-containerregistry_Linux_x86_64.tar.gz -O /opt/crane/src.tar.gz \
&& echo "daa629648e1d1d10fc8bde5e6ce4176cbc0cd48a32211b28c3fd806e0fa5f29b /opt/crane/src.tar.gz" | shasum -c - || exit 1 \
&& tar -C /opt/crane/ -xzvf /opt/crane/src.tar.gz crane \
&& chmod a+x /opt/crane/crane \
&& mv /opt/crane/crane /usr/local/bin/ \
&& rm -r /opt/crane
# Fetch and install git lfs for github integration
RUN mkdir -p /opt/git-lfs \
&& wget https://github.com/git-lfs/git-lfs/releases/download/v3.4.1/git-lfs-linux-amd64-v3.4.1.tar.gz -O /opt/git-lfs/src.tar.gz \
&& echo "1772dc260961db27958088740b7e9ecebf945abad8c2d504d412448f53faf147 /opt/git-lfs/src.tar.gz" | shasum --algorithm 256 -c - || exit 1 \
&& tar -C /opt/git-lfs/ -xzvf /opt/git-lfs/src.tar.gz \
&& bash /opt/git-lfs/git-lfs-3.4.1/install.sh \
&& rm -r /opt/git-lfs
# Get the minio client for development
RUN mkdir -p /opt/mc \
&& wget https://dl.min.io/client/mc/release/linux-amd64/archive/mc.RELEASE.2025-07-16T15-35-03Z -O /opt/mc/mc \
&& echo "a5c3695b6f76ed958c0f099795f32091fced0d748ddc749c8b24e07681bbfbb9 /opt/mc/mc" | shasum -c - || exit 1 \
&& chmod a+x /opt/mc/mc \
&& mv /opt/mc/mc /usr/local/bin/ \
&& rm -r /opt/mc
# Get the docker cli
RUN mkdir -p /opt/docker \
&& wget https://download.docker.com/linux/static/stable/x86_64/docker-27.1.1.tgz -O /opt/docker/docker.tgz \
&& echo "118da6b8fc8e8b6c086ab0dd5e64ee549376c3a3f963723bbc9a46db475bf21f /opt/docker/docker.tgz" | shasum -c - || exit 1 \
&& tar -C /opt/docker/ -xzvf /opt/docker/docker.tgz \
&& chmod a+x /opt/docker/docker/docker \
&& mv /opt/docker/docker/docker /usr/local/bin/ \
&& rm -r /opt/docker
ENV PYTHONUNBUFFERED=1\
AWS_XRAY_SDK_ENABLED=false\
COMPONENTS_SAGEMAKER_SHIM_VERSION=0.6.0\
PATH="/opt/grand-challenge/.venv/bin:/home/django/.local/bin:${PATH}"
RUN mkdir -p /opt/grand-challenge /app /static /opt/sagemaker-shim /opt/virtualenvs \
&& groupadd -r django && useradd -m -r -g django django \
&& chown django:django /opt/grand-challenge /app /static /opt/sagemaker-shim /opt/virtualenvs
USER django:django
# Fetch and install sagemaker shim for shimming containers
RUN mkdir -p /opt/sagemaker-shim \
&& wget "https://github.com/DIAGNijmegen/rse-sagemaker-shim/releases/download/v${COMPONENTS_SAGEMAKER_SHIM_VERSION}/sagemaker-shim-${COMPONENTS_SAGEMAKER_SHIM_VERSION}-Linux-x86_64.tar.gz" -P /opt/sagemaker-shim/ \
&& echo "a3c33f65ee72e039dd90c9d7a3460de33abdd020f530164b8666975a1ae5e192 /opt/sagemaker-shim/sagemaker-shim-${COMPONENTS_SAGEMAKER_SHIM_VERSION}-Linux-x86_64.tar.gz" | shasum -c - || exit 1 \
&& tar -C /opt/sagemaker-shim/ -xzvf "/opt/sagemaker-shim/sagemaker-shim-${COMPONENTS_SAGEMAKER_SHIM_VERSION}-Linux-x86_64.tar.gz" \
&& rm "/opt/sagemaker-shim/sagemaker-shim-${COMPONENTS_SAGEMAKER_SHIM_VERSION}-Linux-x86_64.tar.gz"
# Create virtual environments
RUN mkdir -p /opt/virtualenvs \
&& python -m venv /opt/virtualenvs/biom \
&& /opt/virtualenvs/biom/bin/python -m pip --no-cache-dir --no-color install biom-format
WORKDIR /opt/grand-challenge
# Install base python packages
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project --no-dev
##################
# TEST CONTAINER #
##################
FROM base AS test-base
USER root
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
# Add java and graphviz for plantuml documentation
default-jre \
graphviz \
# make for sphinx docs
make \
# playwright dependencies
libatk1.0-0 \
libatk-bridge2.0-0 \
libatspi2.0-0 \
libxcomposite1 \
libxrandr2 \
libgbm1 \
libxkbcommon0 \
&& rm -rf /var/lib/apt/lists/*
USER django:django
RUN --mount=type=cache,target=/root/.cache/uv \
--mount=type=bind,source=uv.lock,target=uv.lock \
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
uv sync --locked --no-install-project
RUN playwright install