Request A Demo
Back to All Blog Articles

FlexDeploy loves Functions: Build Docker Containers with Fn Functions

This is the fourth article in the blog series on what makes FlexDeploy a perfect fit for container native technologies:

In this post I am going to show how FlexDeploy can leverage Serverless paradigm and use Fn Project functions in a build workflow.

Let’s consider a simple workflow like this:

The goal of this workflow is to build an Oracle Jet application, save the web folder to an artifact repository, build a docker image containing the Jet application and Nginx web server and push the docker image to Docker Hub registry.

The first step of the build workflow Build OJet Application is a Shell plugin operation which invokes an Fn function building an Oracle JET application, zipping the web folder and pushing the zip file to a Nexus repository. The invocation of the function looks like this:


The build Fn function is going to be based on a docker image which we can build with the following Dockerfile:

# Create an image from a "builder" Docker image
# See
FROM eugeneflexagon/ojetbuilder

# install zip 
RUN apt-get update
RUN apt-get install zip -y

# install git 
RUN apt install git-all -y

# copy into container a shell script performing the build
COPY /usr/local/bin/
RUN chmod +x /usr/local/bin/

ENTRYPOINT ["xargs","/usr/local/bin/"]

So, let’s build and push the image to Docker Hub:

docker build -t eugeneflexagon/ojetbuilderfn .
docker push eugeneflexagon/ojetbuilderfn

The image eugeneflexagon/ojetbuilderfn contains git client to fetch source code of the Jet application, OJET Cli to build the application and zip to archive the web folder (result of the build). It also contains shell script which actually, builds, zips and pushes the archive to the Nexus repository:


# Clone the source code
git clone

# Build the application
cd ojetdevops
ojet build

# Archive the web folder
zip -r web web/*

# Push the archive to Nexus
curl -v  -u $1:$2 --upload-file http://$3/nexus/content/repositories/snapshots/jet/$4/

The script accepts four parameters: Nexus username/password, Nexus url and project version to organize Jet archives in the Nexus snapshot repository nicely:


Having eugeneflexagon/ojetbuilderfn Docker image created we can define the build function which is invoked by Build OJet Application workflow step:

fn apps create ojetbuilder
fn routes create ojetbuilder /build eugeneflexagon/ojetbuilderfn:latest

The next step of the workflow Build Docker Image invokes Docker plugin operation buildImage to build a Docker image containing Oracle JET application and a web server:

The image is going to be built with the following Dockerfile:

# Create a 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 web /usr/share/nginx/html

The last step of the workflow Push Docker Image invokes Docker plugin operation pushImage to push the image to Docker Hub:


Having the image pushed to Docker Hub we can pull it and run the container locally:

docker run -it -p 8082:80 eugeneflexagon/ojetdevops:latest

And see the result at http://localhost:8082, or we can deploy the image to a K8s cluster with deploy function as it was described in the previous post.


That’s it!

Previous Post: FlexDeploy Loves Functions: Deploy Docker Containers with Fn Functions

Next Post: FlexDeploy is a Container: Run FlexDeploy as a Docker Container

Related Resources

Mastering Source Control: Streamlining Functional Setup Data Sync with FlexDeploy and Git Integration in Oracle FSM

Effective source control management (SCM) is pivotal in ensuring the seamless tracking and management of functional setup data. In this ...

Oracle Integration Cloud – Migrate Integrations, Connections and Lookups

Oracle Integration Cloud (OIC) serves as a unified platform for seamlessly integrating cloud and on-premises applications. FlexDeploy, a robust DevOps ...

Unlocking Precision in Oracle SaaS FSM: Dive into FlexDeploy’s Filter Criteria for Effortless Setup Migration

While Oracle’s Functional Setup Manager (FSM) UI facilitates export/import operations for transferring setups across environments, the process demands manual initiation, ...

Join DevOps leaders across the globe who receive analysis, tips, and trends in their inbox