forked from wtsi-npg/npg-irods-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
84 lines (61 loc) · 2.18 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
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
FROM --platform=linux/amd64 ubuntu:bionic AS builder
ARG PYTHON_VERSION=3.12
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -q -y --no-install-recommends \
autoconf \
automake \
build-essential \
ca-certificates \
curl \
git \
libtool \
pkg-config \
libffi-dev \
libbz2-dev \
libssl-dev \
zlib1g-dev \
unattended-upgrades && \
unattended-upgrade -d -v
WORKDIR /app
ENV PYENV_ROOT="/app/.pyenv"
# Put PYENV first to ensure we use the pyenv-installed Python
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
COPY . /app
RUN /app/docker/install_pyenv.sh
RUN pyenv install "$PYTHON_VERSION"
RUN pyenv global "$PYTHON_VERSION"
# This drives the choice of base system for this Dockerfile. iRODS 4.2.11 is not
# available for anything more recent than Ubuntu bionic, so that's what we use for
# the builder (above) and for the clients. This is also the reason we resort to
# pyenv to get a recent Python, rather than using a python-slim base image.
FROM --platform=linux/amd64 ghcr.io/wtsi-npg/ub-18.04-irods-clients-4.2.11
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -q -y --no-install-recommends \
ca-certificates \
git \
unattended-upgrades && \
unattended-upgrade -d -v
ENV PYENV_ROOT="/app/.pyenv"
# Put PYENV first to ensure we use the pyenv-installed Python
ENV PATH="${PYENV_ROOT}/shims:${PYENV_ROOT}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=""
WORKDIR /app
COPY --from=builder /app /app
# Mount the .git directory to allow the build to get the version from git
RUN --mount=source=.git,target=.git,type=bind \
pip install --no-cache-dir -r requirements.txt && \
pip install --no-cache-dir . && \
git status && \
ls -al
RUN useradd -l -m -s /bin/false appuser && mkdir /home/appuser/.irods
RUN apt-get remove -q -y unattended-upgrades \
git && \
apt-get autoremove -q -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
USER appuser
ENTRYPOINT ["/app/docker/entrypoint.sh"]
CMD ["check-checksums", "--version"]