Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

FlexDeploy can be configured to automatically build and scan Docker images as a part of your build workflow. In cases where you are running your container directly on a docker runtime you can automatically configure that here as well. Image Removed

Info
titleGetting Started

For a full walkthrough of setting up a FlexDeploy Container Project deploying to Kubernetes via Helm, check out this Getting Started guide.


Image Added

Optionally, a path to Dockerfile can be provided. If it is empty, a default Dockerfile in a project source checkout folder is expected. If the checkout folder is empty, then a Dockerfile is expected in the root of the FD_TEMP_DIR. A Dockerfile must be present to build an image. This behavior changed slightly in 5.0.3 beta. Previously, the location was expected to be in FD_TEMP_DIR/FD_PROJECT_NAME.

...

The build instance must be a Docker host to use this feature, and the dockerBuildProjectImage operation of the FlexDeployDockerPlugin must be associated to the build instance. See Creating and Editing Instances for more information on how to add a plugin operation to an Instance.

SettingInput TypeDescriptionExample
Image NameGroovy

A Groovy Script that evaluates to the local image tag that should be built. This should include the full registry prefix, user repository, image name and tag.

docker.io can be omitted as a registry prefix as that is the default.

"joelwenzel/natours:"+ProjectVersion

"comp.azureio.registry/ourcompany/app:"+ProjectVersion

Registry AccountSelection

Specify a Registry Account (created in Topology->Integrations→Containers) you would like to push your image to. 

Note that this is optional and can be set in Topology Overview Properties as well.

DockerIO
Build ImageBooleanShould FlexDeploy automatically add the buildProjectImage workflow step?true
Push ImageBooleanAfter building the image should it be pushed to the specified Registry?true
Tag LatestBooleanShould the image also be tagged with 'latest'?true

Image Scanning

FlexDeploy supports local image scanning out of the box with Anchore. The only requirement is docker being installed on your build server. The configuration here will always scan the locally built Docker image. If you want to analyze a remote image or publish results to an Anchore Engine application, you will need to modify your workflow with the appropriate Anchore Operations.

SettingInput TypeDescriptionExample
Scan ImageSelection
  • No Scan - No scan will take place
  • Before Push - The built image will be scanned prior to pushing it to a registry
  • After Push - The built image will be scanned after pushing it to a registry. Note that if Push Image is false, then it will be scanned regardless.
BEFORE_PUSH
Fail WhenGroovy

An optional Groovy script to determine if the scan should fail. See the Anchore Plugin for a list of variables and sample scripts.

If the script should evaluate to true (I.E. a failure) then the image building process will halt and the workflow execution will fail. 

STATUS == "fail"
Custom Policy BundlePlain Text

Anchore uses "policy bundles" to define analysis/scanning criteria. You can provide a custom bundle here defining your own scanning requirements. 

You can reference an absolute path on your docker build server or a relative location in your source control for the image.

anchore/customPolicy.json


Info
titleWindows Scanning

At this time, inline(local) image scanning is not supported on windows.


Info
titlePre-deploy Scanning

The configuration shown here executes the scan during the BUILD workflow. Another option can be to execute the scan as a Pre-deploy Workflow. This has the added benefit of creating approval tasks from the scan results.


Container Settings/Deploy

After building the image there are 3 options to consider for deployment. Deploying via helm or standard kubectl to a Kubernetes node. Or running the docker container directly. The below configuration supports the latter approach to deploy and run a docker container directly using the image built during the build workflow.

Every setting here, apart from 'Run Container' is groovy script with ALL of the workflow execution properties available, though only a few of the commonly used are listed in the drop down.

SettingInput TypeDescriptionExample
Run ContainerBooleanShould a container, using the built image and fields below, be started during the deploy workflow. Checking this as true will automatically add the 'deployProjectContainer' operation to your workflow as the first step.true
Container NameGroovy Groovy script to determine what the started container name should be. Be sure to enclose literal strings in quotes."myapp-"+FD_ENVIRONMENT_CODE.toLowerCase()
VolumesGroovy

Optional Groovy script of volumes to expose to the container. Separate entries by a comma. 

hostPath:containerPath,hostPath:containerPath

"C:/data/myapp/"+FD_ENVIRONMENT_CODE.toLowerCase()+":/usr/src/app/data"

PortsGroovy

Optional Groovy script of ports to expose. Separate entries by a comma. 

hostPort:containerPort,hostPort:containerPort

(FD_ENVIRONMENT_CODE == 'DEV' ? '80' : '89') + ":8099"
Additional ParamsGroovyAny additional parameters to the container, which will be added to the run command."--cidfile /test/file.cid -d -e MYVAR1"


Info
titleEmpty Workflow

Note that because the deployProjectContainer is added to the workflow automatically, it is very well possible that your deploy workflow may be empty at design time. 


Info
titleSteps before deployProjectContainer

If you need to run steps prior to deploying the project container but still want to make use of the configuration above, simply add the deployProjectContainer operation anywhere in your workflow and FlexDeploy will forgo adding it automatically.


Container Status

FlexDeploy has the ability to retrieve the status of the container as well as view logs, start and stop. There are a couple of prerequisites in order to make use of this functionality.

  1. Your docker installation must have the Docker API enabled

    1. For configuring SSL see here.
  2. Create a DockerAPI account (Topology->Integrations->Container)

    1.  Image Added
  3. Set the API Account on your Project under the Container Configuration tab

    1. Image Added
  4. Finally, you must ensure the container was deployed via the deployProjectContainer operation, otherwise FlexDeploy will have no record of the container. This happens automatically by checking 'runContainer' in the Container Configuration tab.


With all of that complete you will have access to view and perform actions on the deployed project containers:

Image Added

Image Added

Container Monitoring

All of this information is available under Administration->Monitoring->Containers as well. On this page it will give you a snapshot of all containers running in that environment.

Image Added