Defining Template Customization in Dockerfile

The simplest way to prepare your custom stack is to compose a Dockerfile, where the appropriate platform-managed template is set as a base image, and implement customization on its top.

Tip: Further development of this approach implies possibility to prepare own dockerized stack templates considering the required platform integration specifics - the appropriate guidance will be provided separately.

1. So, go to the Project tab, click the + button and select the New file option from the appeared list.

new project file

2. Within the opened page, specify Dockerfile as a name for this file.

5

Next, in the editor area, add file content according to the following structure:

1
2
FROM jelastic/{image}:{tag}
{your_custom_modifications}

where:

  • {image} - name of the image from jelastic repository you’d like to use as a base for your stack template
  • {tag} - required tag version of the specified template (the full list of available ones can be found by switching to the Tags tab within the appropriate repo details at DockerHub)
  • {custom_modifications} - your code to implement necessary customizations; should be specified with Dockerfile syntax (in our example, we’ve defined to automatically create a hello.txt file in the root folder of each corresponding container)

Tip: You can customize the default list of favorites folders and files for your stack by defining them in the /etc/jelastic/favourites.conf file:

1
2
3
4
[directories]
{directories_list}
[files]
{files_list}

For example, provide the following code in your dockerfile to display home directory in favorites list:

1
RUN mkdir /etc/jelastic/; echo -e "[directories]\n/home" >/etc/jelastic/favourites.con

stack custom favorites

Optionally, specify a descriptive Commit message and choose Target branch to Commit Changes.

After implementing all the required modifications in Dockerfile, configure CI/CD for customized template to be automatically updated upon new commits.

What’s next?