forked from sakaiproject/sakai
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
INFRSTR-368 - Updates to the docker directory
Removed old config that waasn't likely used Put the Dockerfile at the top level with an updated readme Tested that this mimially works with the current version of Sakai TODO ideas in a future fix: * Use docker-compose.yml on the top level to make starting this up easier This would also allow for a persistent volume for MySQL * Split tomcat from the Dockerfile and have it run separately. * Verify if we still need the docker-maven-chrome or if we can use the regular maven to build
- Loading branch information
Showing
74 changed files
with
1,030 additions
and
2,313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
FROM markhobson/maven-chrome:jdk-17 as build | ||
|
||
ARG release=master | ||
|
||
ENV MAVEN_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1" | ||
COPY maven/settings.xml /usr/share/maven/conf/settings.xml | ||
RUN mkdir /deploy | ||
WORKDIR /deploy | ||
RUN git clone --depth 1 https://github.com/sakaiproject/sakai.git | ||
WORKDIR /deploy/sakai | ||
RUN git checkout ${release} && mvn clean install --no-transfer-progress -T 1C sakai:deploy-exploded -Dmaven.test.skip=true | ||
RUN mvn clean && rm -rf /root/.m2/repository | ||
|
||
FROM tomcat:9-jdk17-temurin | ||
|
||
COPY tomcat/conf/* /usr/local/tomcat/conf/ | ||
|
||
RUN mkdir -p /usr/local/tomcat/sakai /usr/local/tomcat/bin | ||
|
||
COPY tomcat/sakai/* /usr/local/tomcat/sakai/ | ||
COPY tomcat/bin/* /usr/local/tomcat/bin/ | ||
|
||
COPY --from=build /deploy/components /usr/local/tomcat/components/ | ||
|
||
# This might be able to deploy to a different lib directory | ||
COPY --from=build /deploy/lib /usr/local/tomcat/lib/ | ||
COPY --from=build /deploy/webapps /usr/local/tomcat/webapps/ | ||
|
||
COPY tomcat/bin/entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,54 @@ | ||
# Sakai Docker Deployment Examples | ||
|
||
A collection of tools and examples to demonstrate developing, building and deploying Sakai using Docker Swarm. | ||
A collection of tools and examples to demonstrate building and deploying Sakai using Docker and/or Docker Swarm. | ||
|
||
### Features | ||
Features of the files you will find here: | ||
|
||
* Development stack examples | ||
* Docker image building examples | ||
* Docker Swarm deployment examples | ||
* Multiple build types: | ||
* From source | ||
|
||
#### Table of Contents | ||
- [Quick install Docker (Linux, new server/workstation)](#quick-install-docker--linux--new-server-workstation-) | ||
- [Building the Image](#building-the-image) | ||
* [From source (github tag/branch)](#from-source--github-tag-branch-) | ||
|
||
|
||
# Quick install Docker (Linux, new server/workstation) | ||
Docker provides an installation script for most Linux distributions, With Ubuntu and RHEL/CentOS being the most used. | ||
This script is located at https://get.docker.com/ and has the following instructions at the top of the file: | ||
|
||
This script is meant for quick & easy install via: | ||
$ curl -fsSL https://get.docker.com -o get-docker.sh | ||
$ sh get-docker.sh | ||
|
||
This will install and prepare everything needed to build images and run them in standalone mode. | ||
Additionally, docker has a built-in container orchestration platform called "Docker Swarm". Swarm needs to be enabled to use any of the deployment example scripts in `deploy/`, this can be enabled by simply running: | ||
|
||
$ docker swarm init | ||
|
||
# Development | ||
In the `dev/` folder you will find an example staged Swarm stack that included everything needed to build and test sakai in development. | ||
|
||
GOTO [Development README](dev/) | ||
|
||
# Building | ||
In the `build/` folder you will find examples for building a docker image for Sakai. Before deployment, you need to build the docker image you will deploy, examples are provided for building from source or a binary release. | ||
|
||
GOTO [Building README](build/) | ||
|
||
# Deployment | ||
Deploying Sakai in Docker Swarm is easy, even with a full stack of supporting services. | ||
|
||
GOTO [Deployment README](deploy/) | ||
$ `curl -fsSL https://get.docker.com -o get-docker.sh` | ||
$ `sh get-docker.sh` | ||
|
||
# Building the Image | ||
There is currently one variant of this docker build, to build from source code. | ||
|
||
## From source (github tag/branch) | ||
The source build uses a multi-stage build, building an intermediate image with JDK and Maven in which to build Sakai, then building a Tomcat image using only the binary artifacts from the build container. This creates a smaller Sakai image that does not include Maven and all the build time libraries, source, etc. | ||
|
||
To build from source use these steps: | ||
1. From this folder | ||
1. Execute `docker build --build-arg release=master -t sakai -f ./Dockerfile.source .` substituting "master" for the branch/tag you wish to build | ||
1. Upon completion you can execute `docker image ls sakai` to verify it's creation | ||
* $ docker image ls sakai | ||
REPOSITORY TAG IMAGE ID CREATED SIZE | ||
sakai latest ac16fc4db9dd About a minute ago 1.86GB | ||
|
||
# Running this image | ||
|
||
## Starting MariaDB/MySQL | ||
You'll need to have MySQL/MariaDB started up first. The default config of the sakai.properties if for MariaDB on localhost. | ||
|
||
Here's a sample to startup MySQL from Docker | ||
``` | ||
# May want to include an opt for docker rm sakai-mariadb | ||
# Start it if we've already created it, unless we want to re-create | ||
docker run -p 127.0.0.1:53306:3306 -d --name="sakai-mariadb" --pull always \ | ||
-e "MARIADB_ROOT_PASSWORD=sakairoot" \ | ||
-v "./mysql/scripts:/docker-entrypoint-initdb.d" \ | ||
-d mariadb:10 --lower-case-table-names=1 || docker start "sakai-mariadb" | ||
``` | ||
## Starting up Sakai and linking to Maria | ||
`docker run --rm -p 8080:8080 --name sakai-tomcat --link sakai-mariadb sakai` |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.