For Datasette #1249 I wanted to build a Docker image from the python:3.9.2-slim-buster
base image ("buster" is the current stable release of Debian) but include a single package from "sid", the unstable Debian distribution.
I needed to do this because the latest version of SpatiaLite, version 5, was available in sid
but not in buster
(which only has 4.3.0a):
https://packages.debian.org/search?keywords=spatialite
The recipe that ended up working for me was to install software-properties-common
to get the apt-get-repository
command, then use that to install a package from sid
:
RUN apt-get update && \
apt-get -y --no-install-recommends install software-properties-common && \
add-apt-repository "deb http://httpredir.debian.org/debian sid main" && \
apt-get update && \
apt-get -t sid install -y --no-install-recommends libsqlite3-mod-spatialite
Here's the full Dockerfile I used:
FROM python:3.9.2-slim-buster as build
# software-properties-common provides add-apt-repository
RUN apt-get update && \
apt-get -y --no-install-recommends install software-properties-common && \
add-apt-repository "deb http://httpredir.debian.org/debian sid main" && \
apt-get update && \
apt-get -t sid install -y --no-install-recommends libsqlite3-mod-spatialite && \
apt clean && \
rm -rf /var/lib/apt && \
rm -rf /var/lib/dpkg
RUN pip install datasette && \
find /usr/local/lib -name '__pycache__' | xargs rm -r && \
rm -rf /root/.cache/pip
EXPOSE 8001
CMD ["datasette"]
Created 2021-03-22T14:42:43-07:00 · Edit