| 1 |
# TODO: Can this Dockerfile use multi-stage build? |
| 2 |
# https://testdriven.io/tips/6da2d9c9-8849-4386-b7f9-13b28514ded8/ |
| 3 |
# Final size 690MB. (It would be 1.16 GB if started with python:3 as base) |
| 4 |
FROM python:3.13-slim |
| 5 |
|
| 6 |
# Install Generic PyGObject (sans GTK) |
| 7 |
#The following somehow won't work: |
| 8 |
#RUN apt-get update && apt-get install -y python3-gi python3-gi-cairo |
| 9 |
RUN apt-get update && apt-get install -y \ |
| 10 |
libcairo2-dev \ |
| 11 |
libgirepository1.0-dev \ |
| 12 |
python3-dev |
| 13 |
|
| 14 |
# Install MSAL Extensions dependencies |
| 15 |
# Don't know how to get container talk to dbus on host, |
| 16 |
# so we choose to create a self-contained image by installing gnome-keyring |
| 17 |
RUN apt-get install -y \ |
| 18 |
gir1.2-secret-1 \ |
| 19 |
gnome-keyring |
| 20 |
|
| 21 |
# Not strictly necessary, but we include a pytest (which is only 3MB) to facilitate testing. |
| 22 |
RUN pip install "pygobject>=3,<4" "pytest>=6,<7" |
| 23 |
|
| 24 |
# Install MSAL Extensions. Upgrade the pinned version number to trigger a new image build. |
| 25 |
RUN pip install "msal-extensions==1.2" |
| 26 |
|
| 27 |
# This setup is inspired from https://github.com/jaraco/keyring#using-keyring-on-headless-linux-systems-in-a-docker-container |
| 28 |
ENTRYPOINT ["dbus-run-session", "--"] |
| 29 |
# Note: gnome-keyring-daemon needs previleged mode, therefore can not be run by a RUN command. |
| 30 |
CMD ["sh", "-c", "echo default_secret | gnome-keyring-daemon --unlock; bash"] |