Use Wercker to create a Docker image of an environment running GlassFish5 on CentOS.
Wercker is a Docker-based CI / CD automation platform.
GlassFish 5 is an application server that is a reference implementation of Java EE 8. Currently, development is underway for the official release, and it has been built and released as a beta version.
I explained below about creating an image of this GlassFish 5 environment built on Docker:
-I made a Dockerfile to start Glassfish 5 using Oracle Java
In the above, the procedure for creating a Docker image is defined in the Dockerfile, and the Docker image is created and published by the Automated Build of Docker Hub.
This time, we will use Wercker to define the procedure for creating a Docker image and publish it to Docker Hub.
Also, in the previous procedure, it was a combination of Oracke Java and Oracle Linux, but this time it will be an environment using CentOS and OpenJDK.
Owning the following accounts:
Change the following part of wercker.xml to your own information.
--USERNAME: DockerHub account name --PASSWORD: DockerHub password --DOCKER_IMAGE_NAME: Image name to publish --DOCKER_IMAGE_TAG: Tags attached to images to be published --DOCKER_IMAGE'S_AUTHOR_NAME: Creator information
- internal/docker-push:
username: [USERNAME]
password: [PASSWORD]
repository: [DOCKER_IMAGE_NAME]
tag: [DOCKER_IMAGE_TAG]
author: [DOCKER_IMAGE'S_AUTHOR_NAME]
cmd: /bin/bash --login
This information can also be set in Wercker as an environment variable without having to write it directly in wercker.xml.
3.1. Create Application
Select "Create"-> "Application" from the menu at the top of the screen
Select GitHub or Bitbucket and select the Wercker application repository you manage there.
With it selected, click Use selected repo.
Leave the default (do not use the SSH key) and click Next Step.
Select whether to make the Wercker application defined here publicly available or private. If you want to publish it, select "Make my app public".
After transitioning to the Build tab screen, click "Trigger a build now" at the bottom of the screen.
If you used environment variables in step 2, define them on the ** Environment ** tab. Information that you do not want to disclose, such as passwords, can be hidden.
You can check the build status in real time with the Build tag.
If the build is successful with Wercker, it will be published to DockerHub with the defined image name. From here, do docker pull
to use the image.
The Docker Hub image I publish launches like this:
docker run -it --rm -p 4848:4848 -p 8080:8080 shinyay/centos7-openjdk8-glassfish5
When you start it, the startup shell ** start-domain.sh ** is placed in the directory immediately after it is started to simplify the startup of GlassFish 5. Doing this launches the default domain (domain1).
[root@4e1fb53e79af ~]# ls
anaconda-ks.cfg start-domain.sh
[root@4e1fb53e79af ~]# ./start-domain.sh
I will check the startup
[root@4e1fb53e79af ~]# asadmin list-domains
domain1 running
Command list-domains executed successfully.
This time, we are using a single pipeline without considering the workflow. In that pipeline, we even build and publish images. I'm thinking of making this a separate pipeline and creating a pipeline that creates and publishes images of different versions and environments in parallel.
Recommended Posts