Skip to content
/ drun Public

drun - Keeping development environments consistent

License

Notifications You must be signed in to change notification settings

rgoomar/drun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

drun (Docker Runner)

Build Status

About

This is a simple CLI to run a container and selective commands with Docker.

The primary purpose for this tool is to help create a consistent development experience.

Notes

  • Currently this will mount the directory you are executing from to /app on the container
    • This is useful for building projects locally
  • This is my first Go project, so there's room for improvement

Installation

Standalone Binary

  1. Download binary from releases
  2. Move the binary to /usr/local/bin/drun
    • mv drun-[arch] /usr/loca/bin/drun
    • chmod +x /usr/local/bin/drun

Building with Go

go get github.com/rgoomar/drun
cd $GOPATH/src/github.com/rgoomar/drun
# if you want to use $GOPATH/bin
go install
# if you want it to be local to the directory
go build

Configuration

You can add a drun.json file in the root of your project or wherever you going to run it.

Config Options

image - Specify Docker image

defaultCommand - Default command to run

net - Network Mode for docker run. Defaults to host for running local servers.

ports - Ports you want to expose, defaults to all ports on container

Example

{
    "image": "openjdk:8",
    "defaultCommand": "./gradlew build",
    "net": "host",
    "ports": {
        "8080":"8080",
        "5000":"5000"
    }
}

Usage

Flags

--image - Specify an image to run

--net - Specify a network mode

[COMMANDS] - Commands to execute in container

Run based on configuration defined

With this configuration:

{
    "image": "openjdk:8",
    "defaultCommand": "./gradlew build"
}

You can run:

drun

Run with image specified in configuration only

With this configuration:

{
    "image": "openjdk:8",
    "defaultCommand": "./gradlew build"
}

You can run:

drun ./gradlew build

Run without configuration

drun --image node:8-alpine node --version