<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Improving Docker image for Alfresco Community repository in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/improving-docker-image-for-alfresco-community-repository/m-p/149133#M104145</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Exciting&amp;nbsp;days for Docker fans,&amp;nbsp;&lt;A href="https://migration33.stage.lithium.com/docs/DOC-7348"&gt;Alfresco Community Edition 201804 EA&lt;/A&gt;&amp;nbsp;is the first community release available as &lt;A href="https://hub.docker.com/u/alfresco/" rel="nofollow noopener noreferrer"&gt;Docker images&lt;/A&gt;. Don't panic if you don't feel&amp;nbsp;this excitement, you can still produce the traditional distribution ZIP file thanks to the &lt;A href="https://github.com/Alfresco/acs-community-packaging" rel="nofollow noopener noreferrer"&gt;acs-community-packaging&lt;/A&gt; project. If you don't even want to use maven, you can&amp;nbsp;download the binary&amp;nbsp;from&amp;nbsp;&lt;A href="https://artifacts.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/alfresco-content-services-community-distribution/6.0.5-ea/alfresco-content-services-community-distribution-6.0.5-ea.zip" rel="nofollow noopener noreferrer"&gt;artifacts.alfresco.com&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On top of that, Alfresco is focusing now on a new deployment paradigm with&amp;nbsp;&lt;A _jive_internal="true" href="https://community.alfresco.com/docs/DOC-7356-new-deployment-mechanism" rel="nofollow noopener noreferrer"&gt;Kubernetes and Helm charts&lt;/A&gt;. This great technologies are out of the scope of this text, my goal on this post is to share some test I've done with the &lt;A href="https://hub.docker.com/r/alfresco/alfresco-content-repository-community/" rel="nofollow noopener noreferrer"&gt;alfresco-content-repository-community&lt;/A&gt; image only from the &lt;STRONG&gt;docker&lt;/STRONG&gt; perspective.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;When I first tried the Docker Compose and Kubernetes + Helm solutions on the acs-community-deployment project, I&amp;nbsp; was surprised about the size of the alfresco-content-repository-community Docker image, is 1,9 Gb when you download it, compressed size on the &lt;A href="https://hub.docker.com/r/alfresco/alfresco-content-repository-community/tags/" rel="nofollow noopener noreferrer"&gt;Dockerhub&lt;/A&gt; image registry is about 710MB. Enterprise is quite different here,&amp;nbsp;on the host is 768MB and compressed on &lt;A href="https://hub.docker.com/r/alfresco/alfresco-content-repository/tags/" rel="nofollow noopener noreferrer"&gt;Dockerhub&lt;/A&gt;&amp;nbsp;is about 405MB. So i decided to make some tests to see if I could make it smaller.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The result of the tests looks pretty cool,&amp;nbsp;&lt;STRONG&gt;smaller container for the Community (6.0.5-ea) than Alfresco has published for Enterprise&amp;nbsp;(6.0.0-RC4).&lt;/STRONG&gt;&amp;nbsp;The deployed image is 446MB and the &lt;A href="https://hub.docker.com/r/keensoft/alfresco-docker-template/tags/" rel="nofollow noopener noreferrer"&gt;compressed size on registry&lt;/A&gt; 393MB. That's &lt;STRONG&gt;1,5 Gb less&lt;/STRONG&gt; than the current published community image.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First&amp;nbsp;I wanted to understand better the difference between both Community vs Enterprise repository image size.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The main difference is that the Community version of the image has libreoffice, imagemagick and alfresco-pdf-renderer command line tools installed along with the repository war (on top of tomcat + java). The enterprise is using another approach, they have built some docker images for each libreoffice, imagemagick and alfresco-pdf-renderer as microservices (spring-boot apps) wrapping this command line tools. This means now Alfresco supports&amp;nbsp;this new properties to connect to external applications as remote services.&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;alfresco-pdf-renderer.url=http://alfresco-pdf-renderer:8090/&lt;BR /&gt;jodconverter.url=http://libreoffice:8090/&lt;BR /&gt;img.url=http://imagemagick:8090/‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the first try was to test if the 201804EA release was accepting this new properties or was only&amp;nbsp;a Enterprise only feature. I don't know what's going to happen&amp;nbsp;on next GA, but by now both work the same.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Secondly, I wanted to make use of the multi-stage building feature present in Docker since version 17.05. I used once on a project to produce tiny images for production and the results were awesome.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The idea of docker multi-stage building is very simple, Dockerfile API supports multiple FROM statements on the same Dockerfile. Each chunk between FROM statements is called a build stage and we can copy stuff from one another as needed. The image you build is only the last chunk, the previous ones are thrown away (intermediate build stages).&amp;nbsp;As simple as good. Instead of doing complicate commands or spent hours finding the bits you can remove and so on, we can do something like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Without multi-state building&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;FROM somebase&lt;BR /&gt;RUN apt-update &amp;amp;&amp;amp; apt-install &amp;lt;a lot of dev libs&amp;gt;&amp;nbsp;&lt;BR /&gt;RUN &amp;lt;build your application artifact&amp;gt;&lt;BR /&gt;RUN &amp;lt;remove a lot of things&amp;gt;‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Multi-state building&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;FROM somebase as builder&lt;BR /&gt;RUN apt-update &amp;amp;&amp;amp; apt-install &amp;lt;a lot of dev libs&amp;gt;&lt;BR /&gt;RUN &amp;lt;build your application artifact&amp;gt;&lt;BR /&gt;&lt;BR /&gt;FROM tomcat:7-jre8&lt;BR /&gt;COPY --from=builder &amp;lt;path/to/artifact&amp;gt; &amp;lt;path/to/webapps&amp;gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The results are more small and simple to maintain. On this particular example, the final size of&amp;nbsp;the image is the size of tomcat:7-jre8 image plus the size of the artifact, nothing more. And we didn't spent time optimizing the image, as we have delegated that to the&amp;nbsp;&lt;STRONG&gt;oficial&lt;/STRONG&gt; base image&amp;nbsp;we're&amp;nbsp;using on the last stage. That's what official base image are for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the resulting Dockerfile&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;FROM debian:stretch as dist&lt;BR /&gt;&lt;BR /&gt;LABEL maintainer "mikel.asla@keensoft.es"&lt;BR /&gt;LABEL version "201804-EA-alpine"&lt;BR /&gt;LABEL description "This is alfresco-docker-template version 201804-EA dist stage"&lt;BR /&gt;&lt;BR /&gt;ENV ALF_ARTIFACT_ID=alfresco-content-services-community-distribution \&lt;BR /&gt; ALF_VERSION=6.0.5-ea \&lt;BR /&gt; ALF_DOWNLOAD_URL=https://artifacts.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco&lt;BR /&gt;&lt;BR /&gt;RUN set -x \&lt;BR /&gt; &amp;amp;&amp;amp; apt-get update \&lt;BR /&gt; &amp;amp;&amp;amp; apt-get install -y --no-install-recommends \&lt;BR /&gt; unzip \&lt;BR /&gt; wget \&lt;BR /&gt; \&lt;BR /&gt; &amp;amp;&amp;amp; mkdir -p /tmp/alfresco \&lt;BR /&gt; &amp;amp;&amp;amp; wget --no-check-certificate &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; $ALF_DOWNLOAD_URL/$ALF_ARTIFACT_ID/$ALF_VERSION/$ALF_ARTIFACT_ID-$ALF_VERSION.zip \&lt;BR /&gt; &amp;amp;&amp;amp; unzip $ALF_ARTIFACT_ID-$ALF_VERSION.zip -d /tmp/alfresco&lt;BR /&gt;&lt;BR /&gt;FROM openjdk:8-jre as amps_install&lt;BR /&gt;&lt;BR /&gt;LABEL maintainer "mikel.asla@keensoft.es"&lt;BR /&gt;LABEL version "201804-EA-alpine"&lt;BR /&gt;LABEL description "This is alfresco-docker-template version 201804-EA amps_install stage"&lt;BR /&gt;&lt;BR /&gt;ENV DIST /tmp/alfresco/alfresco-content-services-community-distribution-6.0.5-ea&lt;BR /&gt;&lt;BR /&gt;WORKDIR /tmp&lt;BR /&gt;&lt;BR /&gt;COPY --from=dist $DIST/bin/alfresco-mmt.jar alfresco-mmt.jar&lt;BR /&gt;COPY --from=dist $DIST/web-server/webapps/alfresco.war alfresco.war&lt;BR /&gt;COPY --from=dist $DIST/amps/alfresco-share-services.amp alfresco-share-services.amp&lt;BR /&gt;&lt;BR /&gt;RUN set -x \&lt;BR /&gt; &amp;amp;&amp;amp; java -jar alfresco-mmt.jar install alfresco-share-services.amp alfresco.war -nobackup&lt;BR /&gt;&lt;BR /&gt;FROM tomcat:7-jre8-alpine&lt;BR /&gt;&lt;BR /&gt;LABEL maintainer "mikel.asla@keensoft.es"&lt;BR /&gt;LABEL version "201804-EA-alpine"&lt;BR /&gt;LABEL description "This is alfresco-docker-template version 201804-EA final stage"&lt;BR /&gt;&lt;BR /&gt;ENV DIST /tmp/alfresco/alfresco-content-services-community-distribution-6.0.5-ea&lt;BR /&gt;&lt;BR /&gt;COPY --from=dist $DIST/web-server/lib/postgresql-42.2.1.jar /usr/local/tomcat/lib/postgresql-42.2.1.jar&lt;BR /&gt;COPY --from=dist $DIST/web-server/webapps/ROOT.war /usr/local/tomcat/webapps/ROOT.war&lt;BR /&gt;COPY --from=amps_install /tmp/alfresco.war /usr/local/tomcat/webapps/alfresco.war&lt;BR /&gt;&lt;BR /&gt;RUN set -x \&lt;BR /&gt; &amp;amp;&amp;amp; cd webapps \&lt;BR /&gt; &amp;amp;&amp;amp; rm -rf ROOT manager docs examples host-manager \&lt;BR /&gt; &amp;amp;&amp;amp; mkdir alfresco ROOT \&lt;BR /&gt; &amp;amp;&amp;amp; unzip alfresco.war -d alfresco \&lt;BR /&gt; &amp;amp;&amp;amp; unzip ROOT.war -d ROOT \&lt;BR /&gt; &amp;amp;&amp;amp; rm -rf *.war&lt;BR /&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can find this Dockerfile along with a docker-compose.yml file to test it&amp;nbsp;inside our &lt;A href="https://github.com/keensoft/alfresco-docker-template/tree/master/201804-EA__alpine" rel="nofollow noopener noreferrer"&gt;alfresco-docker-templates&lt;/A&gt; project. Just enter the 201804-EA__alpine folder and type&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;docker-compose up‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After everything is deployed check your local images to&amp;nbsp;see the following awesome line&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;$ docker images&lt;BR /&gt;&lt;BR /&gt;REPOSITORY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TAG&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IMAGE ID&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CREATED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIZE&lt;BR /&gt;201804ea_alfresco&amp;nbsp;&amp;nbsp;&amp;nbsp; latest&amp;nbsp;&amp;nbsp;&amp;nbsp; 2869666c6237&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 10 minutes ago&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 446MB‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alfresco Community&amp;nbsp;also worths&amp;nbsp;quality docker images. Let's see what happens on next GA release, stay tuned!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 May 2018 19:42:45 GMT</pubDate>
    <dc:creator>mikel_asla</dc:creator>
    <dc:date>2018-05-17T19:42:45Z</dc:date>
    <item>
      <title>Improving Docker image for Alfresco Community repository</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/improving-docker-image-for-alfresco-community-repository/m-p/149133#M104145</link>
      <description>Exciting&amp;nbsp;days for Docker fans,&amp;nbsp;Alfresco Community Edition 201804 EA&amp;nbsp;is the first community release available as Docker images. Don't panic if you don't feel&amp;nbsp;this excitement, you can still produce the traditional distribution ZIP file thanks to the acs-community-packaging project. If you don't even w</description>
      <pubDate>Thu, 17 May 2018 19:42:45 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/improving-docker-image-for-alfresco-community-repository/m-p/149133#M104145</guid>
      <dc:creator>mikel_asla</dc:creator>
      <dc:date>2018-05-17T19:42:45Z</dc:date>
    </item>
  </channel>
</rss>

