Hi all.
I’m trying to improve my Gnucash dev environment to use docker better, so that I can hack on Gnucash better
Here’s my current Dockerfile attempt. Basically I want to cache the build artefacts, so that hacking->make doesn’t require compiling all files. Is this feasible within Docker?
# Stage 1: Build GnuCash and cache build artifacts
FROM ubuntu
WORKDIR /app
# Update the package lists and install build dependencies
RUN apt-get update && \
apt-get install -y build-essential \
cmake \
libgtk2.0-dev \
libxml2-dev \
libxslt-dev \
guile-2.2-dev
RUN apt-get install -y libboost-all-dev \
libdbi-dev \
libdbd-sqlite3 \
libdbd-pgsql \
libaqbanking-dev \
gwenhywfar-tools \
libgoffice-0.10-dev \
libboost-dev
RUN apt-get install -y libboost-all-dev \
python3-dev \
libgnomecanvas2-dev \
guile-2.2-dev \
libgirepository1.0-dev \
libwebkit2gtk-4.0-dev \
libosp-dev
RUN apt-get install -y libboost-all-dev \
swig \
gtk-doc-tools \
docbook-xsl \
docbook-xml \
libsoup2.4-dev
RUN apt-get install -y libboost-all-dev \
libwebkit2gtk-4.0-dev \
libsecret-1-dev \
itstool \
gettext \
libwebkit2gtk-4.0-dev \
git \
zip
RUN apt-get install -y libofx-dev googletest
COPY . /app
RUN cd /app
RUN mkdir -p build && cd build && cmake -DWITH_AQBANKING=OFF .. && make -j4 && make install
# --mount=type=cache,target=./build,sharing=locked \
CMD ["/app/build/bin/gnucash"]
ENTRYPOINT ["/app/build/bin/gnucash"]
Wish to design the following: (In pseudo code)
“rebuild” stage
load dependencies
copy . /app (i.e. load repo)
cmake (i.e. create build dir - must be persistent)
make (compile build into executables - must be persistent)
“hacking” stage
copy build, executables from above
copy . /app (i.e. refresh repo)
make (efficient recompilation of changed source code only)
make install
copy installation files into folder outside container.
Thus I’d want to run “rebuild” once, then “hacking” during heavy development. Otherwise the COPY->CMAKE->MAKE stages would take 10mins. With the above pseudocode, modifying only 1-2 files would recompile only the changed files. Many thanks for considering!