If you want to run dockerized Alfresco Community on your M1 Macbook there are some steps you have to follow and traps you have to avoid. Most importantly:
- currently (02.2022) amd64 Java isn't perfect on arm64. You should recompile everything to use arm64 architecture. As a bonus you will get quite good performance.
- to compile Alfresco content services, Oracle's Java is needed. The ones from OpenJDK, Zulu, Temurin just does not work...
- while creating alfresco-content and alfresco-share images, you should add some amps to amps/amps_share directory. Especially share-services. js-console and ootb-support-tools are nice to have.
- by default alfresco-search has mutal TLS turned on. While you are developing, it is better to specify
ALFRESCO_SECURE_COMMS=none
(orsecret
in the newer versions)
- Install maven and Oracle's JDK. As of 02.2022 this versions are working:
➜ mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /opt/apache-maven
Java version: 11.0.2, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk-11.0.2.jdk/Contents/Home
Default locale: en_PL, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
- Create alfresco-base-java-arm64 Docker image
git clone [email protected]:Alfresco/alfresco-docker-base-java.git
- In the Dockerfile change image to arm64. Example:
FROM arm64v8/centos:7.9.2009 AS centos7
- Compile:
mvn clean install -DskipTests
- Create image:
docker build -t alfresco-base-java-arm64 . --build-arg DISTRIB_NAME=centos --build-arg DISTRIB_MAJOR=7 --build-arg JAVA_MAJOR=11 --build-arg JDIST=jdk --no-cache --target JAVA_BASE_IMAGE
- Create alfresco-base-tomcat-arm64 Docker image
- Clone repo:
git clone [email protected]:Alfresco/alfresco-docker-base-tomcat.git
- In the Dockerfile change java image to previously created alfresco-base-java-arm64. Example:
FROM alfresco-base-java-arm64 AS centos7
- Compile:
mvn clean install -DskipTests
- ** In the Dockerfile change
make -j "$(nproc)"
tomake
- nproc variable does not exist on arm64 centOS - Craete image:
docker build -t alfresco-base-tomcat-arm64 . --build-arg DISTRIB_NAME=centos --build-arg DISTRIB_MAJOR=7 --build-arg JAVA_MAJOR=11 --build-arg TOMCAT_MAJOR=10 --no-cache
-
Optionally: download and compile additional Alfresco extensions (i.e. OOTB Support Tools)
-
Optionally: Add api-explorer
- Clone repo:
git clone https://github.com/Alfresco/rest-api-explorer.git
- Checkout specific version:
git checkout 7.2.0
(Alfresco 7.2) - Compile:
mvn clean install -DskipTests
- Now you have
target/api-explorer.war
which you can later copy to thealfresco-community-repo/packaging/docker-alfresco/target/war/
- Create alfresco-content-repository-community-arm64 Docker image
- Clone repo:
git clone [email protected]:Alfresco/alfresco-community-repo.git
- Checkout specific version:
git checkout 14.145
Alfresco 7.2) - Compile:
mvn clean install -DskipTests
- Go to the packaging/docker-alfresco
- Copy all amps (most importantly share-services in the /amps/share-services/target/ dir) to the packaging/docker-alfresco/target/amps/
- In the Dockerfile change:
- FROM directive. Example:
alfresco-docker-base-tomcat-dcevm-arm64:latest
- Add following lines in the end (before USER)
RUN chgrp -R alfresco ${TOMCAT_DIR}/webapps ${TOMCAT_DIR}/amps ${TOMCAT_DIR}/lib && \ find ${TOMCAT_DIR}/webapps -type d -exec chmod 0750 {} \; && \ find ${TOMCAT_DIR}/webapps -type f -exec chmod 0640 {} \; && \ chmod -R g+rwx ${TOMCAT_DIR}/webapps && \ chmod 664 ${TOMCAT_DIR}/amps/*
- FROM directive. Example:
- Create a Docker image:
docker buildx build . --load --platform linux/arm64 -t alfresco-content-repository-community-arm64
- Create alfresco-share-arm64 Docker image
git clone [email protected]:Alfresco/alfresco-community-share.git
- Checkout specific version:
git checkout 14.96
(Alfresco 7.2) - Compile:
mvn clean install -DskipTests
- Copy all custom amps (i.e. js-console, ootbee-support-tools) to the packaging/docker/target/amps_share/
- Go to packaging/docker and remove LABEL directive from the Dockerfile and change FROM to i.e.
FROM alfresco-docker-base-tomcat-dcevm-arm64:latest
- Create an image:
docker buildx build . --load --platform linux/arm64 -t alfresco-share-arm64
- Create alfresco-search-services-arm64 Docker image
-
Clone repo:
git clone [email protected]:Alfresco/SearchServices.git
-
Checkout specific version:
git checkout 2.0.3
(Alfresco 7.2) -
Go to search-services and compile:
mvn clean install -DskipTests
-
Go to packaging/target/docker-resources
-
In the search_config_setup.sh:
- ( before 2.0.3 ) in the first line add
ALFRESCO_SECURE_COMMS=none
(it can be also setup by the ENV variable) - ( after 2.0.3 ) in the first line add
ALFRESCO_SECURE_COMMS=secret
and add to the switch-case sedalfresco.secureComms.secret=secret\n
and in your docker images you have to add the following lines- in the sol6->environment
ALFRESCO_SECURE_COMMS: "secret"
JAVA_TOOL_OPTIONS: " -Dalfresco.secureComms.secret=secret"
- in the alfresco->environment->JAVA_OPTS
-Dsolr.secureComms=secret
-Dsolr.sharedSecret=secret
- in the sol6->environment
- ( before 2.0.3 ) in the first line add
-
open Dockerfile and modify:
- FROM (i.e.
FROM alfresco-base-java-dcevm-arm64
)
- FROM (i.e.
-
Create an image:
docker buildx build . --load --platform linux/arm64 -t alfresco-search-services-arm64
- In your all-in-one alfresco maven project change Dockerfile (FROM) and docker-compose.yml (JAVA_TOOL_OPTIONS, image) to use previously created images.
- While downloading images from GitHub it is recommended to checkout specific release tag.
- If you face compile error, it probably means your maven is using wrong JDK or you have installed wrong JDK.