Ok, here goes:
I create a postgresql database:
sudo docker run --name lep-postgresql -v /opt/pg_lr/dbdata:/var/lib/postgresql -d postgres:9.4
Followed by:
sudo docker run -it --link lep-postgresql:postgres --rm postgres:9.4 sh -c 'exec psql -h $POSTGRES_PORT_5432_TCP_ADDR -p 5432 -U postgres'
CREATE USER lportal WITH PASSWORD 'lportal';
CREATE DATABASE lportal WITH ENCODING 'UTF8';
GRANT ALL PRIVILEGES ON DATABASE lportal to lportal;
\q
Then I launch the Liferay with Tomcat container:
sudo docker run --name=lr -p 8080:8080 -v /var/liferay-home/deploy:/opt/liferay-portal-6.2-ce-ga4/deploy --link lep-postgresql:db_lep -d -e DB_TYPE=POSTGRESQL richarduijen/liferay_so_lrsync:latest
The liferay_so_lrsync container is built with the following dockerfile content:
# Liferay + Social Office + Liferay Sync + RCS Newsletter
#
# 0.1 (20150901): working version with persistent postgresql database without plugins
# 0.2 (20150902): (not yet) working version with the above and Social Office CE plugged in
#
# Based on Liferay 6.2 VERSION 0.0.7 using liferay 6.2-ce-ga4 by Samuel Nasello <samuel.nasello@elosi.com>
#
# Reason: I could'nt find any versions supporting persistent data (including pages) or liferay plug-ins. Furthermore, I wanted this particular configuration as a template.
#=======================================#
# Standard context of debian and Java 7 #
#=======================================#
FROM snasello/docker-debian-java7:7u79
MAINTAINER Richard Uijen <richard.uijen@ru4d.nl>
#===================================#
# Basic Liferay install with Tomcat #
#===================================#
# install liferay
RUN curl -O -s -k -L -C - http://downloads.sourceforge.net/project/lportal/Liferay%20Portal/6.2.3%20GA4/liferay-portal-tomcat-6.2-ce-ga4-20150416163831865.zip \
&& unzip liferay-portal-tomcat-6.2-ce-ga4-20150416163831865.zip -d /opt \
&& rm liferay-portal-tomcat-6.2-ce-ga4-20150416163831865.zip
#===========================================#
# Add database and plugin specific settings #
#===========================================#
# add config for databases
RUN /bin/echo -e '\nCATALINA_OPTS="$CATALINA_OPTS -Dexternal-properties=portal-bd-${DB_TYPE}.properties"' >> /opt/liferay-portal-6.2-ce-ga4/tomcat-7.0.42/bin/setenv.sh
# add configuration liferay file (content extended for RCS newsletter and Social Office)
COPY lrsols/portal-bundle.properties /opt/liferay-portal-6.2-ce-ga4/portal-bundle.properties
COPY lrsols/portal-bd-MYSQL.properties /opt/liferay-portal-6.2-ce-ga4/portal-bd-MYSQL.properties
COPY lrsols/portal-bd-POSTGRESQL.properties /opt/liferay-portal-6.2-ce-ga4/portal-bd-POSTGRESQL.properties
#===================================================#
# Social Office plugin (abandoned in version 0.2) #
# portal-bundle.properties adapted conformingly #
#===================================================#
# add the plugin to the deploy directory for automatic deployment of Social Office CE plugin at startup (currently impossible to download directly from liferay.com)
#COPY so/SocialOfficeCE.lpkg /var/liferay-home/deploy/SocialOfficeCE.lpkg
#==================================================#
# Liferay sync plugin (to be added in version 0.3) #
#==================================================#
#====================================================#
# RCS Newsletter plugin (to be added in version 0.4) #
#====================================================#
# volumes (unknown what var liferay home is supposed to do, the other is the liferay home directory)
VOLUME ["/var/liferay-home", "/opt/liferay-portal-6.2-ce-ga4/"]
# Ports
EXPOSE 8080
# Set JAVA_HOME
ENV JAVA_HOME /opt/java
# EXEC
CMD ["run"]
ENTRYPOINT ["/opt/liferay-portal-6.2-ce-ga4/tomcat-7.0.42/bin/catalina.sh"]
I have tried to copy the plugin file to the autodeploy folder in the dockerfile, but apparently that is not the way the dockerfile works… the file didn’t show up in the folder, no error message was given after running the image.
I then manually put the plugin file in the /var/liferay-home/deploy folder and I could see how it was processed. After logging into the liferay application, I could see the Social Office bar.
I committed the running container, and ran it with the same command as above (adapted for the right image), no Social Office. I saved the image, and ran it on a different machine: no Social Office.
The only way forward that I see now, is to copy the liferay processes used for the autodeploy function, but that is a lot of work!
I am wondering what changes the commit function does and what it doesn’t capture. I’m running version 1.8.1 of Docker. I want to run it on a diskstation, with Docker 1.6 on it.