-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
74 lines (58 loc) · 2.12 KB
/
Dockerfile
File metadata and controls
74 lines (58 loc) · 2.12 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
# Base Image, now with Python!
ARG PYTHON_VERSION=3.14.0
ARG UBUNTU_VERSION=noble
FROM python:${PYTHON_VERSION}-bookworm AS python-builder
# can't bump from bookworm to trixie without breaking SSL (for jammy and noble)
FROM ghcr.io/minchinweb/base:${UBUNTU_VERSION}
# keep apt happy
ARG DEBIAN_FRONTEND=noninteractive
# these are provided by the build hook when run on Docker Hub
ARG BUILD_DATE="1970-01-01T00:00:00Z"
ARG COMMIT="local-build"
ARG URL="https://github.com/MinchinWeb/docker-python"
ARG BRANCH="none"
LABEL maintainer="MinchinWeb" \
org.label-schema.description="Personal base image, now with Python!" \
org.label-schema.build-date=${BUILD_DATE} \
org.label-schema.vcs-url=${URL} \
org.label-schema.vcs-ref=${COMMIT} \
org.label-schema.schema-version="1.0.0-rc1"
# copy pip config to remove local caching
COPY root/ /
# copy Python from official image
COPY --from=python-builder /usr/local /usr/local
# register Python .so files
WORKDIR /usr/local/lib
RUN ldconfig
RUN \
echo "[*] apt update" && \
apt -qq update && \
echo "[*] apt install" && \
apt -qq install -y \
libc6 \
# needed for pip
libexpat1 \
&& \
echo "[*] cleanup from apt" && \
rm -rf /var/lib/apt/lists/*
# disable checks for `pip` upgrades (we're upgrading anyway)
ARG PIP_DISABLE_PIP_VERSION_CHECK=1
# don't write .pyc files
# https://stackoverflow.com/questions/59732335/is-there-any-disadvantage-in-using-pythondontwritebytecode-in-docker
ENV PYTHONDONTWRITEBYTECODE=1
# ensures console output is not buffered by Docker
ENV PYTHONUNBUFFERED=1
# Ignore warnings about running pip as root, but only for the build
ARG PIP_ROOT_USER_ACTION=ignore
RUN python -m pip --version
RUN python -m pip install pip --upgrade
RUN python -m pip install setuptools wheel build --upgrade
# store Python Version; used for image tagging
# ARG needs to be declared here, and above any FROM line
# https://github.com/moby/moby/issues/37345#issuecomment-400245466
ARG PYTHON_VERSION
ENV PYTHON_VERSION=${PYTHON_VERSION}
ARG UBUNTU_VERSION
ENV UBUNTU_VERSION=${UBUNTU_VERSION}
WORKDIR /app
CMD ["python"]