-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (28 loc) · 856 Bytes
/
Dockerfile
File metadata and controls
40 lines (28 loc) · 856 Bytes
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
# Still in LTS as of june '24. python2 support isn't a thing in 26.04(ubuntu:latest) either
ARG BASE_IMAGE=ubuntu:22.04
FROM ${BASE_IMAGE}
ENV DEBIAN_FRONTEND=noninteractive \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
PATH="/opt/venv/bin:${PATH}"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
python2 \
python3 \
python3-pip \
python3-venv \
r-base \
ca-certificates \
curl && \
ln -s /usr/bin/python2 /usr/bin/python && \
rm -rf /var/lib/apt/lists/*
RUN python3 -m venv /opt/venv
WORKDIR /app
COPY requirements.txt .
# always more secure to run as non-root
RUN useradd -m appuser && \
chown -R appuser:appuser /opt/venv /app
USER appuser
RUN pip install --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
CMD ["sleep", "infinity"]