In this post I am going to show a simple CI solution for an Oracle Jet application basing on Docker Hub Automated Builds feature. The solution is container native meaning that Docker Hub is going to automatically build a Docker image according to a Docker file. The image is going to be stored in Docker Hub registry. A Docker file is a set of instructions on how to build a Docker image and those instructions may contain any actions including building an Oracle Jet application. So, what we need to do is to create a proper Docker file and set up Docker Hub Automated Build.
I am going to build an Oracle Jet application with OJet CLI, so I have created a Docker image having OJet CLI installed and serving as an actual builder. The image is built with the following Dockerfile:
I am going to build an Oracle Jet application with OJet CLI, so I have created a Docker image having OJet CLI installed and serving as an actual builder. The image is built with the following Dockerfile:
FROM node
RUN npm install -g @oracle/ojet-cli
By running this command:
docker built -t eugeneflexagon/ojetbuilder .
Having done that we can use this builder image in a Dockerfile to build our Jet application:
# Create an image from a "builder" Docker image FROM eugeneflexagon/ojetbuilder # Copy all sources inside the new image COPY . . # Build the appliaction. As a result this will produce web folder. RUN ojet build # Create another Docker image which runs Jet application # It contains Nginx on top of Alpine and our Jet appliction (web folder) # This image is the result of the build and it is going to be stored in Docker Hub FROM nginx:1.10.2-alpine COPY --from=0 web /usr/share/nginx/html EXPOSE 80Here we are using the multi-stage build Docker feature when we actually create two Docker images: one for building and one for running, and only the last one is going to be saved as the final image. So, I added this Docker file to my source code on GitHub.
The next step is to configure Docker Hub Automated Build:
That was easy. Now we can change the source code and once it is pushed to GutHub the build is automatically queued:
Once the build is finished we can pull and run the container locally:
docker run -it -p 8082:80 eugeneflexagon/ojetdevops:latest
And see the result at http://localhost:8082
That's it!