wefork / wekan

The open-source Trello-like kanban (built with Meteor)
https://wekan.io
MIT License
61 stars 12 forks source link

locally build docker image #71

Closed stephenmoloney closed 7 years ago

stephenmoloney commented 7 years ago
stephenmoloney commented 7 years ago

@xet7 Changed it to mongo:3.4 as requested.

I tried to do it with variable substitution as follows image: mongo:${MONGO_VERSION:-3.4} but it didn't work so hard coded it instead.

I'd like to add a few things more but the best place for it would be a wiki.

If you are accepting this PR, a companion wiki would be very useful for users. How can I go about that?

martingabelmann commented 7 years ago

Thanks i was waiting for this to get started with wefork :+1:
I think the image size can be reduced a lot by putting everything in one RUN statement (otherwise one does not benefit from the cleanup, since the first layers with all the build dependencies installed are still there).

stephenmoloney commented 7 years ago

@martingabelmann Thanks for the tip, I didn't actually know that.

I think there is merit in running a single RUN command but even then I'd imagine the image size will be big.

I have an alternative idea for the build process and to massively reduce the image size. Just not sure when I will have time to work on it.

For now, I'd prefer splitting into multiple RUN command purely to save readability (for now at least).

martingabelmann commented 7 years ago

@stephenmoloney I just did the changes (everything in on RUN) for comparison:
It is a delta of ~700MB which is about 65% to the current image size (1.1133GB). Furthermore: when running the suggested apt-get autoremove the imagesize gets decreased at further 47% down to absolute image size of 223MB which is nice.
Im not sure wether the autoremove is OK or if there are packages that are actually needed to run the app. The list is:

The following packages were automatically installed and are no longer required:
  adduser binutils ca-certificates cpp cpp-4.7 fakeroot file g++ g++-4.7 gcc
  gcc-4.7 git-man krb5-locales less libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libbsd0 libc-dev-bin
  libc6-dev libclass-isa-perl libcurl3 libcurl3-gnutls libdpkg-perl libedit2
  liberror-perl libexpat1 libfile-fcntllock-perl libgdbm3 libgmp10 libgomp1
  libgssapi-krb5-2 libidn11 libitm1 libk5crypto3 libkeyutils1 libkrb5-3
  libkrb5support0 libmagic1 libmpc2 libmpfr4 libncursesw5 libpopt0
  libquadmath0 librtmp0 libsqlite3-0 libssh2-1 libstdc++6-4.7-dev
  libswitch-perl libtimedate-perl libx11-6 libx11-data libxau6 libxcb1
  libxdmcp6 libxext6 libxmuu1 linux-libc-dev make manpages manpages-dev
  mime-support openssh-blacklist openssh-blacklist-extra openssh-client
  openssl patch perl perl-modules python-minimal python2.7 python2.7-minimal
  rsync xauth

Maybe one can prevent from installing them in the first place by adding the --no-recommends flag to the apt-get install or using an alpine base image (typically they handle dependencies optimized for docker).

BTW it should be possible to have one RUN block formatted in a humand readable way by escaping additional linebreaks...

stephenmoloney commented 7 years ago

@martingabelmann Making those changes makes some sense. Can you make a separate PR for those?

About alpine, as far as i know, you will run into issues trying to build meteor with alpine. I have an idea here on potentially using alpine but only after removing some intermediate containers for the build process... This would reduce the final image enormously but I haven't time yet to develop this idea.

Thanks. 👍