Verified Commit 8917a6a9 authored by Dom Sekotill's avatar Dom Sekotill
Browse files

Update Dockerfile python version

parent f4c4622c
Loading
Loading
Loading
Loading
+13 −22
Original line number Diff line number Diff line
# syntax = docker/dockerfile:1.3-labs

### BUILD
# FROM quay.io/pypa/manylinux2014_x86_64 as build

## Install dependencies
# RUN yum install -y \
#     mariadb-devel \
#     wget

FROM python:3.9-slim as build
RUN apt update && apt install -y libmariadb-dev build-essential
FROM python:3.12-slim as build
RUN apt update && apt install -y libmariadb-dev build-essential pkg-config

COPY --from=docker.kodo.org.uk/kodo.org.uk/docker/docker-build-helpers:latest \
    /scripts /bin
@@ -22,26 +12,27 @@ RUN --mount=type=bind,source=kodo_sso,target=/src/kodo_sso \
RUN <<END_SCRIPT
set -eu
bootstrap-stage
find /usr/local/lib/python3.9/lib-dynload \
find /usr/local/lib/python3.* \
    -name '_tkinter.*' -prune \
    -o -type f -print0 |
    -o -name '*.so' -type f \
    -print0 |
xargs -0 collect-binaries \
    /bin/sh \
    /usr/local/bin/python3.9 \
    /usr/local/lib/libpython3.9.so* \
    /usr/local/bin/python3.* \
    /usr/local/lib/libpython3.*.so* \
    /usr/lib/*/libmariadbclient.so
ln -s python3.9 /stage/usr/local/bin/python
ln -s /usr/local/bin/python3.*[0-9] /stage/usr/local/bin/python
cp /usr/local/bin/kodo-sso /usr/local/bin/gunicorn /stage/bin/
mkdir -p /stage/usr/local/lib/python3.9 
mkdir -p /stage/usr/local/lib/python3.* 
{
    find /usr/local/lib/python3.9/ \
    find /usr/local/lib/python3.*/ \
        -mindepth 1 -maxdepth 1 \
        \( \
            -name site-packages \
            -o -name lib-dynload \
            -o -name 'config-*' \
        \) -prune -o -print
    find /usr/local/lib/python3.9/site-packages \
    find /usr/local/lib/python3.*/site-packages \
        -mindepth 1 -maxdepth 1 \
        \( \
            -name 'README.txt' \
@@ -49,15 +40,15 @@ mkdir -p /stage/usr/local/lib/python3.9
            -o -name 'pip*' \
            -o -name 'setuptools*' \
            -o -name 'wheel*' \
            -o -name '*.so' \
        \) -prune -o -print
} | while read fname; do
    cp -r "$fname" /stage/usr/local/lib/python3.9/
    cp -r "$fname" /stage/usr/local/lib/python3.*/
done
END_SCRIPT


### INSTALL
# FROM python:3.7-slim as final
FROM scratch as final

LABEL uk.org.kodo.maintainer = "Dom Sekotill <dom.sekotill@kodo.org.uk>"