Commit 8b84c126 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Add a framework for building Krita under Docker

Now you can have a Krita build in 30 minutes on any Linux OS without
thinkign about the deps (because the deps are prebuilt by KDE).

The docker image uses the same dependencies that are used by KDE CI
for building AppImage builds, therefore the resulting build will look
(and work) almost exactly as the user-delivered AppImage.
parent a99fea91
FROM kdeorg/appimage-base
MAINTAINER Dmitry Kazakov <>
RUN apt-get update && apt-get -y install curl
ENV USRHOME=/home/appimage
RUN chsh -s /bin/bash appimage
RUN locale-gen en_US.UTF-8
USER appimage
RUN echo 'export LC_ALL=en_US.UTF-8' >> ${USRHOME}/.bashrc && \
echo 'export LANG=en_US.UTF-8' >> ${USRHOME}/.bashrc && \
echo "export PS1='\u@\h:\w>'" >> ${USRHOME}/.bashrc && \
echo 'source ~/' >> ${USRHOME}/.bashrc && \
echo 'prepend PATH ~/bin/' >> ${USRHOME}/.bashrc
RUN mkdir -p ${USRHOME}/appimage-workspace/krita-inst && \
mkdir -p ${USRHOME}/appimage-workspace/krita-build && \
mkdir -p ${USRHOME}/bin
COPY ./default-home/ \
./default-home/.bash_aliases \
COPY ./default-home/ \
ADD persistent/krita-appimage-deps.tar ${USRHOME}/appimage-workspace/
CMD tail -f /dev/null
# Krita developer environment Docker image
This *Dockerfile* is based on the official KDE build environmet [0]
that in used on KDE CI for building official AppImage packages.
Therefore running this image in a docker container is the best way
to reproduce AppImage-only bugs in Krita.
[0] -
## Prerequisites
Firstly we need to download deps and Krita source tree. These steps are not
included into the *Dockerfile* to save internael bandwidth (most Krita
developers already have al least one clone of Krita source tree).
# download the deps archive
# mount/copy/chechout Krita sources to 'persistent/krita'
mkdir -p persistent/krita
sudo mount --bind ../../ ./persistent/krita
## Build the docker image and run the container
./bin/build_image krita-deps
./bin/run_container krita-deps krita-build
## Enter the container and build Krita
# enter the docker container
./bin/enter_container krita-build
# ... now your are inside the container with all the deps prepared ...
# build Krita as usual
cd appimage-workspace/krita-build/ ~/persistent/krita
make -j8 install
# start Krita
## Extra developer tools
If you want to develop Krita, you might want to install at least some
developer tools into the container, e.g. GDB, Valgring, ccmake and QtCreator.
To do that, execute the following from yout **host** console:
sudo docker exec -ti apt install gdb
sudo docker exec -ti apt install valgrind
sudo docker exec -ti apt install cmake-curses-gui
# inside the container
cd ~/persistent
# when going through the setup wizard select not to install any
# extra Qt libraries, install QtCreator only!
## Stopping the container and cleaning up
When not in use you can stop the container. All your filesystem state is saved, but
all the currently running processes are killed (just ensure you logout from all the
terminals before stopping).
sudo docker stop krita-build
If you don't need your container/image anymore, you can delete them from the docker
# remove the container
sudo docker rm krita-build
# remove the image
sudo docker rmi krita-deps
TODO: do we need some extra cleaups for docker's caches?
## Troubleshooting
### Krita binary is not found after the first build
Either relogin to the container or just execute `source ~/`
### Not enough space on root partition
All the docker images and containers are stored in a special docker-daemon controlled
folder under */var* directory. You might not have enough space there for building Krita
(it needs about 10 GiB). In such a case it is recommended to move the docker images
folder into another location, where there is enough space.
echo 'DOCKER_OPTS="-g /home/devel5/docker"' > /etc/default/docker
if [ ! -d ./persistent ]; then
mkdir ./persistent
if [ ! -f ./persistent/krita-appimage-deps.tar ]; then
cd ./persistent/
wget || exit 1
if [ "$#" -ne 1 ]; then
echo "Usage: $0 IMAGE_NAME" >&2
exit 1
sudo docker build -t $1 .
if [ "$#" -ne 1 ]; then
echo "Usage: $0 CONTAINER_NAME" >&2
exit 1
sudo docker exec -ti $1 sh -c "cd /home/appimage && /bin/bash -l"
if [ "$#" -ne 2 ]; then
echo "Usage: $0 IMAGE_NAME CONTAINER_NAME" >&2
exit 1
sudo docker run -P -t -d \
-v $(pwd)/persistent/:/home/appimage/persistent/:rw \
-v /tmp/.X11-unix/:/tmp/.X11-unix \
-v /home/$USER/.Xauthority:/home/appimage/.Xauthority \
-v /etc/localtime:/etc/localtime:ro \
--device /dev/dri \
--device /dev/snd \
-p127.0.0.1:2022:22 \
--name $2 \
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
prepend() { [ -d "$2" ] && eval $1=\"$2\$\{$1:+':'\$$1\}\" && export $1 ; }
export KRITADIR=/home/appimage/appimage-workspace/krita-inst
export DEPSDIR=/home/appimage/appimage-workspace/deps/usr
prepend PATH $KRITADIR/bin
prepend PKG_CONFIG_PATH $KRITADIR/lib64/pkgconfig
prepend PKG_CONFIG_PATH $KRITADIR/lib/pkgconfig
prepend PATH $DEPSDIR/bin
prepend XDG_DATA_DIRS $DEPSDIR/share
prepend PKG_CONFIG_PATH $DEPSDIR/lib64/pkgconfig
prepend PKG_CONFIG_PATH $DEPSDIR/lib/pkgconfig
prepend PYTHONPATH $DEPSDIR/lib/python3.5/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment