Skip to content

Commit a27478f

Browse files
Simplify Dockerfile
1 parent 26c583e commit a27478f

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

Dockerfile

+18-21
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
1-
FROM ubuntu:22.04
1+
FROM openjdk:11-slim as openjdk-11
22

3-
ENV DEBIAN_FRONTEND=noninteractive
4-
RUN \
5-
--mount=type=cache,target=/var/cache/apt \
3+
FROM python:3.9-slim as python
4+
5+
COPY --from=openjdk-11 /usr/local/openjdk-11 /usr/local/openjdk
6+
ENV JAVA_HOME /usr/local/openjdk
7+
RUN update-alternatives --install /usr/bin/java java /usr/local/openjdk/bin/java 1
8+
9+
RUN --mount=type=cache,target=/var/cache/apt \
610
apt-get update -y && \
7-
apt-get upgrade -y
8-
RUN \
9-
--mount=type=cache,target=/var/cache/apt \
10-
apt-get install -y software-properties-common && \
11-
add-apt-repository -y ppa:deadsnakes/ppa
12-
RUN \
13-
--mount=type=cache,target=/var/cache/apt \
14-
apt-get install -y python3.9 python3.9-dev python3.9-venv python3-pip python-is-python3 openjdk-11-jdk git
15-
16-
ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/
17-
18-
RUN \
19-
--mount=type=cache,target=/root/.cache/pip \
11+
apt-get install -y git
12+
13+
RUN --mount=type=cache,target=/root/.cache/pip \
2014
([ -d /venv ] || python3.9 -m venv /venv) && \
2115
/venv/bin/pip install --upgrade pip
2216

2317
WORKDIR /workspace/
24-
ADD .git/ .git/
25-
ADD pyproject.toml pyproject.toml
2618

27-
RUN \
19+
ADD pyproject.toml pyproject.toml
20+
ARG PSEUDO_VERSION=1
21+
RUN --mount=type=cache,target=/root/.cache/pip \
22+
SETUPTOOLS_SCM_PRETEND_VERSION=${PSEUDO_VERSION} \
23+
/venv/bin/pip install -e .[pyterrier]
24+
RUN --mount=source=.git,target=.git,type=bind \
2825
--mount=type=cache,target=/root/.cache/pip \
29-
/venv/bin/pip install /workspace[pyterrier]
26+
/venv/bin/pip install -e .[pyterrier]
3027

3128
ENV TERRIER_VERSION="5.7"
3229
ENV TERRIER_HELPER_VERSION="0.0.7"

0 commit comments

Comments
 (0)