{"id":21322107,"url":"https://github.com/advantageous/docker-java-runzip","last_synced_at":"2025-03-15T22:44:53.264Z","repository":{"id":77190906,"uuid":"65570418","full_name":"advantageous/docker-java-runzip","owner":"advantageous","description":"An image that downloads a zip and runs a run.sh for that image. This should work with gradle dist plugin to run a Java application easily in Docker.","archived":false,"fork":false,"pushed_at":"2016-08-16T06:26:53.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-22T11:47:58.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/advantageous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2016-08-12T17:12:28.000Z","updated_at":"2016-08-12T18:51:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"67625f36-631e-4bd2-9553-9b25c81ad164","html_url":"https://github.com/advantageous/docker-java-runzip","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fdocker-java-runzip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fdocker-java-runzip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fdocker-java-runzip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/advantageous%2Fdocker-java-runzip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/advantageous","download_url":"https://codeload.github.com/advantageous/docker-java-runzip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801612,"owners_count":20350106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-21T20:13:17.978Z","updated_at":"2025-03-15T22:44:53.257Z","avatar_url":"https://github.com/advantageous.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Docker Java RunZip\nAllows you to easily run a Java zip dist file that was built with `gradle distZip`.\n\nDeployed at [dockerhub advantageous/run-java-zip](https://hub.docker.com/r/advantageous/run-java-zip/).\nSource code at [github](https://github.com/advantageous/docker-java-runzip/).\n\nWritten by Rick Hightower.\n\n\n## Overview\nIf you set two environment variables, `JAVA_ZIP_LOCATION` and `JAVA_RUN_COMMAND`\nthis image will download the zip file at `JAVA_ZIP_LOCATION` and then run the command\n`JAVA_RUN_COMMAND`. This allows us to reuse the same image for many services built\nwith gradle.\n\nLocation `JAVA_ZIP_LOCATION` is a URL (S3 or Artifactory) to a zip file.\n`JAVA_ZIP_LOCATION` URL is expected to be set to an Java zip file\nbuilt with gradle `distZip`.\n\nThe `JAVA_RUN_COMMAND` environment variable sets the command to run after unzipping.\n\n#### JAVA_RUN_COMMAND\n```\nJAVA_RUN_COMMAND=/opt/sample-dcos-0.9.4/bin/sample-dcos\n```\n\nThe image uses a simple install.sh.\n\n#### install.sh\n```\ncd opt\nwget $JAVA_ZIP_LOCATION\nunzip *.zip\n$JAVA_RUN_COMMAND\n```\n\n## Usage\nTo run this docker container run it with `JAVA_RUN_COMMAND` and `JAVA_ZIP_LOCATION`\nset as follows:\n\n## Usage DOCKER\n#### Running a Java dist from Docker\n```\nRUN_ENV=\"-e JAVA_ZIP_LOCATION=https://s3-us-west-2.amazonaws.com/sample-deploy/sample-dcos-0.9.4.zip\"\nRUN_ENV=\"$RUN_ENV -e JAVA_RUN_COMMAND=/opt/sample-dcos-0.9.4/bin/sample-dcos\"\ndocker run -t -i  $RUN_ENV  advantageous/run-java-zip:0.1 /opt/install.sh\n```\n\n\n## Usage DC/OS Mesosphere\n#### To run this app in DC/OS or Mesosphere\n```\ndcos marathon app add mesos-deploy.json\n```\n\n#### mesos-deploy.json\n```javascript\n{\n  \"acceptedResourceRoles\": [\n    \"slave_public\"\n  ],\n  \"container\": {\n    \"type\": \"DOCKER\",\n    \"docker\": {\n      \"image\": \"advantageous/run-java-zip:0.1\",\n      \"network\": \"BRIDGE\",\n      \"portMappings\": [\n        {\n          \"containerPort\": 8080,\n          \"hostPort\": 0,\n          \"servicePort\": 0,\n          \"protocol\": \"tcp\"\n        },\n        {\n          \"containerPort\": 9090,\n          \"hostPort\": 0,\n          \"protocol\": \"tcp\"\n        }\n      ]\n    }\n  },\n  \"cmd\": \"/opt/install.sh\",\n  \"cpus\": 0.5,\n  \"env\": {\n    \"DEPLOYMENT_ENVIRONMENT\": \"staging\",\n    \"JAVA_ZIP_LOCATION\": \"https://s3-us-west-2.amazonaws.com/sample-deploy/sample-dcos-0.9.4.zip\",\n    \"JAVA_RUN_COMMAND\": \"/opt/sample-dcos-0.9.4/bin/sample-dcos\"\n  },\n  \"healthChecks\": [\n    {\n      \"gracePeriodSeconds\": 30,\n      \"intervalSeconds\": 20,\n      \"maxConsecutiveFailures\": 3,\n      \"path\": \"/__admin/ok\",\n      \"portIndex\": 1,\n      \"protocol\": \"HTTP\"\n    }\n  ],\n  \"id\": \"sample-dcos2\",\n  \"instances\": 1,\n  \"mem\": 1024,\n  \"portDefinitions\": [\n    {\n      \"name\": \"eventbus\",\n      \"port\": 0,\n      \"protocol\": \"tcp\"\n    },\n    {\n      \"name\": \"admin\",\n      \"port\": 0,\n      \"protocol\": \"tcp\"\n    }\n  ],\n  \"upgradeStrategy\": {\n    \"minimumHealthCapacity\": 0\n  }\n}\n```\n\nCheck to see if it is running.\n\n```sh\n$ dcos marathon app list\n/sample-dcos2          1024  0.5    1/1    0/1      scale       DOCKER   /opt/install.sh\n```\n\nFind the IP address of the server that our app is running on.\n\n```sh\n$ dcos task\nNAME                  HOST          USER  STATE  ID                                                         \nsample-dcos2          10.16.205.15  root    R    sample-dcos2.3df2501f-60bb-11e6-8de6-ea046373ee46   \n```\n\n## Development notes\nWe use packer for this project.\n\n#### Packer provision script for this project java-run-docker.json\n```javascript\n{\n  \"builders\":\n  [\n    {\n      \"type\": \"docker\",\n      \"image\": \"openjdk:8u102-jdk\",\n      \"commit\": true\n    }\n  ],\n  \"provisioners\": [\n    {\n      \"type\" : \"file\",\n      \"source\": \"./install.sh\",\n      \"destination\": \"/opt/install.sh\"\n    },\n    {\n      \"type\" : \"shell\",\n      \"inline\" : [\n        \"chmod +x /opt/install.sh\"\n      ]\n    }\n  ],\n  \"post-processors\": [\n    [\n      {\n        \"type\": \"docker-tag\",\n        \"repository\": \"advantageous/run-java-zip\",\n        \"tag\": \"0.1\"\n      },\n      {\n        \"type\": \"docker-tag\",\n        \"repository\": \"advantageous/run-java-zip\",\n        \"tag\": \"latest\"\n      },\n      \"docker-push\"\n    ]\n  ]\n\n}\n```\n\nTo build an image we run this.\n\n#### Running packer\n```\n packer build java-run-docker.json\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvantageous%2Fdocker-java-runzip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadvantageous%2Fdocker-java-runzip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadvantageous%2Fdocker-java-runzip/lists"}