-
Create a Dockerfile for the new custom Repository Docker
Image.
As a developer you are most likely running ACS 6.x via a Docker Compose file, either via trial or SDK. The Dockerfile will be based on the Repository Image that is used in the docker-compose.xml file. Have a look in it and you should see that it starts with defining the Alfresco Repository Docker image:
version: "2" services: alfresco: image: alfresco/alfresco-content-repository:6.1.0 ...
With this information we know what Docker Image to base our custom Repo Docker Image on. Create a Dockerfile in the same directory as the content model XML files and have it look like this:
FROM alfresco/alfresco-content-repository:6.1.0 ARG TOMCAT_DIR=/usr/local/tomcat # Make sure we got the ReST API Explorer available COPY api-explorer.war $TOMCAT_DIR/webapps/ # Copy in the custom content model for upload file example COPY acme-content-model.xml acme-bootstrap-context.xml $TOMCAT_DIR/shared/classes/alfresco/extension/
What this Dockerfile will do is build a custom Repository Docker image that is based on the out-of-the-box Alfresco Repository Docker image that you are using. It will then copy in the api-explorer.war into the tomcat/webapps directory followed by a copy of the custom content model files into an extension directory where they can be picked up and bootstrapped.
-
Build the custom Alfresco Repository Docker image.
When we got the Dockerfile completed we just need to build the custom Docker image as follows, standing in the directory with all the files:
repo mbergljung$ docker build -t alf-repo-custom:1.0 . Sending build context to Docker daemon 954.4kB Step 1/4 : FROM alfresco/alfresco-content-repository:6.1.0 ---> 5439a493ee0a Step 2/4 : ARG TOMCAT_DIR=/usr/local/tomcat ---> Using cache ---> cf2a1261adf4 Step 3/4 : COPY api-explorer.war $TOMCAT_DIR/webapps/ ---> Using cache ---> 52f10e1f00d6 Step 4/4 : COPY acme-content-model.xml acme-bootstrap-context.xml $TOMCAT_DIR/shared/classes/alfresco/extension/ ---> 1766782c545a Successfully built 1766782c545a Successfully tagged alf-repo-custom:1.0
Check that you got the custom Docker image:
repo mbergljung$ docker image ls |grep alf- alf-repo-custom 1.0 1766782c545a About a minute ago 1.16GB
-
Update the docker-compose.xml file to use the new custom
image.
Open up the docker-compose.xml file and change it so the Repository service is based on the custom Docker Image we just created. It should now look something like this:
version: "2" services: alfresco: image: alf-repo-custom:1.0 ...
-
Restart ACS.
We have made changes only to the Repository container, also known as the alfresco Docker Compose service, but we need to remove and restart all containers so data is in sync (basically we are starting over with an empty repository). After we have created our own Docker Image for the Alfresco Repository container and configured Docker Compose with it we can restart as follows by doing Ctrl-C out of the log, this will stop all containers, we then remove them, followed by starting it up again:
^CGracefully stopping... (press Ctrl+C again to force) Stopping acs61_alfresco-pdf-renderer_1 ... done ... acs61 mbergljung$ docker-compose rm Going to remove acs61_alfresco-pdf-renderer_1, acs61_transform-router_1, acs61_libreoffice_1, acs61_tika_1, acs61_imagemagick_1, acs61_proxy_1, acs61_share_1, acs61_postgres_1, acs61_digital-workspace_1, acs61_alfresco_1, acs61_activemq_1, acs61_solr6_1, acs61_shared-file-store_1 Are you sure? [yN] y Removing acs61_alfresco-pdf-renderer_1 ... done ... acs61 mbergljung$ docker-compose up Creating acs61_alfresco-pdf-renderer_1 ... done ...
CAUTION: You will lose your data/content when you do this.