Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Nipunich/docker

Open more actions menu
 
 

Repository files navigation

Ballerina Docker Extension

Annotation based docker extension implementation for ballerina.

Build Status License

Features:

  • Dockerfile generation based on @docker:Config annotations.
  • Docker image generation.
  • Docker push support with docker registry.
  • Docker based ballerina debug support.
  • Copy file support.

Supported Annotations:

@docker:Config{}

  • Supported with ballerina services or endpoints.
Annotation Name Description Default value
name Name of the docker image output balx file name
registry Docker registry None
tag Docker image tag latest
buildImage Whether to build docker image true
dockerHost Docker host IP and docker PORT. ( e.g minikube IP and docker PORT) unix:///var/run/docker.sock
dockerCertPath Docker cert path null
baseImage Base image to create the docker image ballerina/ballerina:latest
enableDebug Enable debug for ballerina false
debugPort Remote debug port 5005
push Push to remote registry false
username Username for docker registry None
password Password for docker registry None

@docker:CopyFiles{}

  • Supported with ballerina services or endpoints.
Annotation Name Description Default value
source source path of the file (in your machine) None
target target path (inside container) None
isBallerinaConf flag whether file is a ballerina config file false

@docker:Expose{}

  • Supported with ballerina endpoints.

How to run

  1. Download and install JDK 8 or later
  2. Get a clone or download the source from this repository (https://github.com/ballerinax/docker)
  3. Run the Maven command mvn clean install from within the docker directory.
  4. Copy target/docker-extension-0.9***.jar file to <BALLERINA_HOME>/bre/lib directory.
  5. Run ballerina build <.bal filename> to generate artifacts.

The docker artifacts will be created in a folder called docker with following structure.

|── docker
|    └── Dockerfile
└── outputfilename.balx

Annotation Usage Sample:

import ballerina/http;
import ballerinax/docker;

@docker:Expose{}
endpoint http:Listener helloWorldEP {
    port:9090
};

@http:ServiceConfig {
      basePath:"/helloWorld"
}
@docker:Config {
    registry:"docker.abc.com",
    name:"helloworld",
    tag:"v1.0"
}
service<http:Service> helloWorld bind helloWorldEP {
    sayHello (endpoint outboundEP, http:Request request) {
        http:Response response = new;
        response.setTextPayload("Hello, World from service helloWorld ! \n");
        _ = outboundEP -> respond(response);
    }
}

Refer samples for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 93.2%
  • Ballerina 4.2%
  • Dockerfile 2.6%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.