- Create a directory somewhere for Repository extension files and copy the War file there.Now, copy the WAR file, for example api-explorer-7.0.0.war into this new directory. Then rename the file to api-explorer.war.
-
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:7.0.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
WAR file and have it look like this:
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 where it will be picked up and deployed.
FROM alfresco/alfresco-content-repository:7.0.0 ARG TOMCAT_DIR=/usr/local/tomcat # Copy the ReST API Explorer into the Tomcat Webapps directory COPY api-explorer.war $TOMCAT_DIR/webapps/
-
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/3 : FROM alfresco/alfresco-content-repository:7.0.0 ---> 5439a493ee0a Step 2/3 : ARG TOMCAT_DIR=/usr/local/tomcat ---> Using cache ---> cf2a1261adf4 Step 3/3 : COPY api-explorer.war $TOMCAT_DIR/webapps/ ---> Using cache ---> 52f10e1f00d6 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 acs62_alfresco-pdf-renderer_1 ... done ... acs61 mbergljung$ docker-compose rm Going to remove acs62_alfresco-pdf-renderer_1, acs62_transform-router_1, acs62_libreoffice_1, acs62_tika_1, acs62_imagemagick_1, acs62_proxy_1, acs62_share_1, acs62_postgres_1, acs62_digital-workspace_1, acs62_alfresco_1, acs62_activemq_1, acs62_solr6_1, acs62_shared-file-store_1 Are you sure? [yN] y Removing acs62_alfresco-pdf-renderer_1 ... done ... acs61 mbergljung$ docker-compose up Creating acs62_alfresco-pdf-renderer_1 ... done ...
CAUTION: You will lose your data/content when you do this.