Pystan 2 Dockerfile Example?

Does anyone have an example of a dockerfile that they have used to get Pystan 2.19 working?

All my attempts so far have resulted in me getting the same error when I go to compile a model: distutils.errors.CompileError: command ‘gcc’ failed with exit status 1

Here is my (non-working dockerfile):
FROM python:3.8-slim-bullseye

RUN echo ‘deb Index of /debian testing main’ >> /etc/apt/sources.list
&& apt-get update -y
&& apt-get install -y gcc
&& rm -rf /var/lib/apt/lists/*

RUN pip install numpy
cython
pystan==2.19.1.1

And when I run the command gcc --version in the container I get: gcc (Debian 11.2.0-12) 11.2.0

I appreciate any ideas. Thank you.

Could you try installing build-essential?

You might also need python-dev.

You could also try using a non-slim base image, e.g. python:3.10.0-bullseye

That sufficed for the latest version of pystan a month ago:

Can confirm that this does appear to work just fine on the non-slim base image (and with no need to install gcc)

FROM python:3.8-bullseye

RUN pip install numpy cython pystan==2.19.1.1

(I tested it with the 8schools example on the Pystan2 getting started page and it compiled and sampled successfully)