{"id":42148141,"url":"https://github.com/peter-mount/kernel","last_synced_at":"2026-01-26T18:01:06.891Z","repository":{"id":85760413,"uuid":"54047685","full_name":"peter-mount/kernel","owner":"peter-mount","description":"A Java CDI application container which runs within a Docker container","archived":false,"fork":false,"pushed_at":"2018-03-05T20:16:41.000Z","size":23,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-06T21:38:27.084Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peter-mount.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2016-03-16T16:18:36.000Z","updated_at":"2017-06-14T14:04:00.000Z","dependencies_parsed_at":"2023-05-04T17:46:19.009Z","dependency_job_id":null,"html_url":"https://github.com/peter-mount/kernel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/peter-mount/kernel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-mount%2Fkernel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-mount%2Fkernel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-mount%2Fkernel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-mount%2Fkernel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peter-mount","download_url":"https://codeload.github.com/peter-mount/kernel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peter-mount%2Fkernel/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28784093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T13:55:28.044Z","status":"ssl_error","status_checked_at":"2026-01-26T13:55:26.068Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-26T18:00:30.216Z","updated_at":"2026-01-26T18:01:06.882Z","avatar_url":"https://github.com/peter-mount.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kernel\n\nKernel is a Docker based CDI container which allows a Java application to be built and deployed within the Docker environment.\n\nAll they need to do is to deploy their jar's within the /opt/kernel/lib/ directory and they will then get deployed.\n\n## Using this image\n\nFirst you need to create your CDI application as usual. Any beans that you want to be loaded when the application starts you need to add an observer, that's described below.\n\nNext create a docker file and put your jar's into the /opt/kernel/lib/`artifactId` directory. You could put them directly under lib but this allows you to deploy\nmultiple applications into one container.\n\nA good example is our [Fileserver](https://github.com/peter-mount/fileserver) application. There you will see the relevant pom.xml, Dockerfile and assembly.xml\nthat are required to build your application's image.\n\n### Generic Docker file\nHere's an example docker file you can use to create a new application:\n```\nFROM area51/kernel:latest\n\nADD myapplication.tar /opt/kernel/lib/myapplication\n```\n\nThere's no need to add CMD etc as they are inherited, although you can add whatever you want to the image.\n\n### Opendata Docker file\nAs this project is mainly used for the opendata project, there's a second image available which also includes our core CDI modules like configuration support etc.\n\n```\nFROM area51/kernel:latest-opendata\n\nADD myapplication.tar /opt/kernel/lib/myapplication\n```\n\n## Starting an application bean\n\nFor an application to start you need to tell the bootstrap to load a CDI bean on startup and you're application will load.\nTo do this you simply need to observe the `onl.area51.kernel.CommandArguments` interface\n\nFirst you need the following dependency added to maven:\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eonl.area51.kernel\u003c/groupId\u003e\n    \u003cartifactId\u003ekernel-core\u003c/artifactId\u003e\n    \u003cversion\u003e1.0-SNAPSHOT\u003c/version\u003e\n    \u003cscope\u003eprovided\u003c/scope\u003e\n\u003c/dependency\u003e\n```\n\nNext your core application bean, for example:\n\n```java\npackage my.application;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport onl.area51.kernel.CommandArguments;\n\n@ApplicationScoped\npublic class MyApplication {\n\n    void boot( @Observes CommandArguments args )\n    {\n        // Nothing to do here, it's presence ensures the bean is instantiated by CDI\n    }\n\n    @PostConstruct\n    void start()\n    {\n        // Optional, will be called when the application is shutdown\n    }\n\n    @PreDestroy\n    void stop()\n    {\n        // Optional, will be called when the application is shutdown\n    }\n}\n```\n\nWhen the application starts then this bean will be instantiated. If a method is annotated with `@PostConstruct` then it will be called, then the method with\n`@Observes CommandArguments`. At that point your bean is loaded and running.\n\nOn shutdown any method annotated with `@PreDestroy` will be invoked as normal.\n\n### Command line arguments\nNormally there won't be any as this is invoked from within the docker environment, but any command line arguments (i.e. think `public static void main(String[] args)`)\nwill be in the `CommandArguments` instance which you can access using `List\u003cString\u003e getArguments();`.\n\n## Running your application\n\nYou run your application just like any other docker container. Although part of another project a pre-built example would be:\n```\ndocker run -it --rm area51/fileserver\n```\nThis will download and run our fileserver container which is based on this project. Press ctrl-C to shut it down.\n\n## Environment variables\nThe following variables are supported by the Kernel which in most instances you won't need to use. Your application can add to these\n\nvariable | default | description\n-------- | ------- | -----------\nKERNEL_LIB | /opt/kernel | The location under which the application's jar files are located\nKERNEL_DEBUG | | If set to true then additional debugging is included in the logs.\n\n## Directory layout within the container\n\ndirectory/file | contents\n--------- | --------\n/opt/kernel/kernel.jar | The kernel bootstrap\n/opt/kernel/logging.properties | The logging configuration specific for docker\n/opt/kernel/start | Shell script to start the kernel\n/opt/kernel/cdilib | jars forming the CDI container. This is Weld but could be replaced by any CDI2 based container.\n/opt/kernel/lib | your application jars go into subdirectories under here\n/opt/kernel/sharedlib | common jars. The opendata image places its jars under here\n/opt/kernel/ext | optional extension jars\n\n## Available images\n\nimage | content\n----- | -------\narea51/kernel | latest generic image\narea51/kernel:latest | latest generic image\narea51/kernel:latest-opendata | latest opendata image\n\nYou can see the entire list on [Docker Hub](https://hub.docker.com/r/area51/kernel/tags/)\n\n## History\n\nOriginally this was a simple runtime which was part of the [OpenData](https://github.com/peter-mount/opendata) project and based on it's\n[opendata-kernel](https://github.com/peter-mount/opendata-common/tree/master/opendata-kernel) module.\n\nThis version is similar to that but customized to run only within a docker environment.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-mount%2Fkernel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-mount%2Fkernel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-mount%2Fkernel/lists"}