Code Monkey home page Code Monkey logo

docker's Introduction

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.

docker's People

Contributors

anuruddhal avatar ballerina-bot avatar keizer619 avatar lakwarus avatar maheshika avatar manuranga avatar natashawso2 avatar pubudu91 avatar uthaiyashankar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.