refactoring , dockerizing
This commit is contained in:
54
environment/dev/docker/app/readme.md
Normal file
54
environment/dev/docker/app/readme.md
Normal file
@@ -0,0 +1,54 @@
|
||||
# Building the docker image
|
||||
|
||||
## Dockerfile
|
||||
|
||||
The Dockerfile can be found in the root folder of the project.
|
||||
|
||||
## Available Environment Variables
|
||||
|
||||
|
||||
| property name | description | values |
|
||||
|----------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
|
||||
| DB_TYPE | type of the db enginge. | mysql, h2 |
|
||||
| DB_URL | jdbc url of the db | "jdbc:mysql://ucs-intranet-db-author:3306/magnolia" |
|
||||
| DB_USER | username for the db | root |
|
||||
| DB_PASSWORD | password for the db | root |
|
||||
| CATALINA_OPTS_APPEND | Java options form tomcat | "-Xms512M -Xmx2048M " |
|
||||
| JAVA_OPTS | addition java options for application | "-agentlib:jdwp=transport=dt_socket,address=*:54455,server=y,suspend=n" |
|
||||
| MAGNOLIA_UPDATE_AUTO | set the property 'magnolia.update.auto' in magnolia.properties | ${MAGNOLIA_UPDATE_AUTO} |
|
||||
| MAGNOLIA_AUTHORINSTANCE_URL | public accessible url of the author instance | http://author.ucsintranet.at |
|
||||
| MAGNOLIA_UCSWEBSITE_AUTHORINSTANCE_URL | public accessible url of the author instance of the UCS website | http://author.ucsintranet.at |
|
||||
| MAGNOLIA_PUBLICINSTANCE_URL | public accessible url of the public instance | http://public.ucsintranet.at |
|
||||
| MAGNOLIA_PROFILE | the magnolia profile to use (see: https://docs.magnolia-cms.com/product-docs/6.2/releases/release-notes-for-magnolia-cms-6.2.2/#_profile_based_configuration_of_property_files) | magnoliaAuthor, magnoliaPublic |
|
||||
| KEYCLOAK_REALM | the keycloak realm to use | magnolia |
|
||||
| KEYCLOAK_CLIENT_ID_AUTHOR | the author keycloak client id | author.ucsintranet |
|
||||
| KEYCLOAK_CLIENT_ID_PUBLIC | the author keycloak client id | author.ucsintranet |
|
||||
| KEYCLOAK_AUTH_URL | <TBD> | ${KEYCLOAK_AUTH_URL} |
|
||||
| KEYCLOAK_SSL_REQUIRED | <TBD> | external |
|
||||
| KEYCLOAK_CREDENTIALS_SECRET_AUTHOR | author keycloak secret | |
|
||||
| KEYCLOAK_CREDENTIALS_SECRET_PUBLIC | public keycloak secret | |
|
||||
|
||||
## About the image
|
||||
|
||||
The image is based on the cli provided by magnolia ( a.k.a mgnl).
|
||||
To get more information about the mgnl cli tool, please visit the [mgnl documentation](https://docs.magnolia-cms.com/magnolia-cli/4.x/)
|
||||
|
||||
The project generated by the mgnl tool, already includes the author and public instances!
|
||||
Be sure, that in production you restrict the access to the author instance, and to the admin components
|
||||
|
||||
The image is set up so, that it uses the folder "/magnolia/light-modules" as resources dir.
|
||||
While build the image, the <PROJECT_ROOT>/magnolia/modules will be copied in to the image as "/magnolia/light-modules".
|
||||
For development, the <PROJECT_ROOT>/magnolia/modules can be mounted, so the changes in the lightmodules are "live/instant"
|
||||
|
||||
## Building & pushing the image
|
||||
|
||||
The easiest way to build and pusht the image is, to run the next commands
|
||||
```bash
|
||||
npm run docker:build
|
||||
```
|
||||
|
||||
```bash
|
||||
npm run docker:push
|
||||
```
|
||||
|
||||
For more details, pls examine the package.json file, and the scripts in docker/magnolia/scripts folder
|
||||
5
environment/dev/docker/app/scripts/build.docker.build.sh
Executable file
5
environment/dev/docker/app/scripts/build.docker.build.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR=$(dirname "$0")
|
||||
source "${CURRENT_DIR}/build.docker.build.step.inc.version.sh"
|
||||
source "${CURRENT_DIR}/build.docker.build.step.build.sh"
|
||||
12
environment/dev/docker/app/scripts/build.docker.build.step.build.sh
Executable file
12
environment/dev/docker/app/scripts/build.docker.build.step.build.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR=$(dirname "$0")
|
||||
# build docker image
|
||||
source "${CURRENT_DIR}/build.docker.env.sh"
|
||||
PROJECT_ROOT=$(readlink -f "${CURRENT_DIR}/../../../../../yoga-app")
|
||||
|
||||
echo "build image ${TAG} from folder ${PROJECT_ROOT}"
|
||||
|
||||
cd $PROJECT_ROOT
|
||||
|
||||
docker build --platform linux/amd64 -t $TAG .
|
||||
17
environment/dev/docker/app/scripts/build.docker.build.step.inc.version.sh
Executable file
17
environment/dev/docker/app/scripts/build.docker.build.step.inc.version.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# set the actual commit date and commit hash in version.txt
|
||||
GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
GIT_BRANCH_SHORT=$(echo $GIT_BRANCH | cut -d "/" -f 1)
|
||||
GIT_COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y%m%d%H%M)
|
||||
GIT_COMMIT_ID_SHORT=$(git rev-parse --short HEAD)
|
||||
|
||||
VERSION=$GIT_COMMIT_DATE.$GIT_COMMIT_ID_SHORT
|
||||
|
||||
CURRENT_DIR=$(dirname "$0")
|
||||
VERSION_FILE="${CURRENT_DIR}/version.txt"
|
||||
|
||||
echo "Saving version ${VERSION} to file ${VERSION_FILE}"
|
||||
|
||||
echo $VERSION
|
||||
echo $VERSION > $VERSION_FILE
|
||||
|
||||
9
environment/dev/docker/app/scripts/build.docker.env.sh
Executable file
9
environment/dev/docker/app/scripts/build.docker.env.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR=$(dirname "$0")
|
||||
VERSION_FILE="${CURRENT_DIR}/version.txt"
|
||||
echo "Reading version file: ${VERSION_FILE}"
|
||||
|
||||
export VERSION=$(cat "${VERSION_FILE}")
|
||||
|
||||
export TAG=docker.rschneider.hu/infra/yoga-app:$VERSION
|
||||
7
environment/dev/docker/app/scripts/build.docker.push.sh
Executable file
7
environment/dev/docker/app/scripts/build.docker.push.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURRENT_DIR=$(dirname "$0")
|
||||
# push docker image
|
||||
source "${CURRENT_DIR}/build.docker.env.sh"
|
||||
echo "push image ${TAG}"
|
||||
docker push $TAG
|
||||
1
environment/dev/docker/app/scripts/version.txt
Normal file
1
environment/dev/docker/app/scripts/version.txt
Normal file
@@ -0,0 +1 @@
|
||||
202501071722.a8b144f
|
||||
Reference in New Issue
Block a user