├── .editorconfig ├── .github ├── CODEOWNERS ├── dependabot.yml ├── labels.yml └── workflows │ ├── gosum.yml │ ├── labels.yml │ └── released.yml ├── .gitignore ├── .travis.yml ├── CHANGELOG.md ├── LICENSE ├── README.md ├── build.properties ├── build.xml ├── go.mod ├── go.sum ├── main.go └── res ├── app.ico ├── papp.ico ├── papp.manifest ├── papp.png ├── run.iss ├── setup-mini.bmp └── start.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs. 2 | # More information at http://editorconfig.org 3 | 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_size = 2 9 | indent_style = space 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [*.md] 15 | trim_trailing_whitespace = false 16 | 17 | [*.go] 18 | indent_style = tab 19 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @crazy-max 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "gomod" 4 | directory: "/" 5 | schedule: 6 | interval: "daily" 7 | time: "08:00" 8 | timezone: "Europe/Paris" 9 | labels: 10 | - ":game_die: dependencies" 11 | - ":robot: bot" 12 | - package-ecosystem: "github-actions" 13 | directory: "/" 14 | schedule: 15 | interval: "daily" 16 | time: "08:00" 17 | timezone: "Europe/Paris" 18 | labels: 19 | - ":game_die: dependencies" 20 | - ":robot: bot" 21 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | ## more info https://github.com/crazy-max/ghaction-github-labeler 2 | - # bot 3 | name: ":robot: bot" 4 | color: "69cde9" 5 | description: "" 6 | - # broken 7 | name: ":zap: broken" 8 | color: "a3090e" 9 | description: "" 10 | - # bug 11 | name: ":bug: bug" 12 | color: "b60205" 13 | description: "" 14 | - # dependencies 15 | name: ":game_die: dependencies" 16 | color: "0366d6" 17 | description: "" 18 | - # documentation 19 | name: ":memo: documentation" 20 | color: "c5def5" 21 | description: "" 22 | - # duplicate 23 | name: ":busts_in_silhouette: duplicate" 24 | color: "cccccc" 25 | description: "" 26 | - # enhancement 27 | name: ":sparkles: enhancement" 28 | color: "0054ca" 29 | description: "" 30 | - # feature request 31 | name: ":bulb: feature request" 32 | color: "0e8a16" 33 | description: "" 34 | - # feedback 35 | name: ":mega: feedback" 36 | color: "03a9f4" 37 | description: "" 38 | - # future maybe 39 | name: ":rocket: future maybe" 40 | color: "fef2c0" 41 | description: "" 42 | - # good first issue 43 | name: ":hatching_chick: good first issue" 44 | color: "7057ff" 45 | description: "" 46 | - # help wanted 47 | name: ":pray: help wanted" 48 | color: "4caf50" 49 | description: "" 50 | - # hold 51 | name: ":hand: hold" 52 | color: "24292f" 53 | description: "" 54 | - # invalid 55 | name: ":no_entry_sign: invalid" 56 | color: "e6e6e6" 57 | description: "" 58 | - # maybe bug 59 | name: ":interrobang: maybe bug" 60 | color: "ff5722" 61 | description: "" 62 | - # needs more info 63 | name: ":thinking: needs more info" 64 | color: "795548" 65 | description: "" 66 | - # question 67 | name: ":question: question" 68 | color: "3f51b5" 69 | description: "" 70 | - # trademark violation 71 | name: ":construction: trademark violation" 72 | color: "cfe524" 73 | description: "" 74 | - # upstream 75 | name: ":eyes: upstream" 76 | color: "fbca04" 77 | description: "" 78 | - # wontfix 79 | name: ":coffin: wontfix" 80 | color: "ffffff" 81 | description: "" 82 | -------------------------------------------------------------------------------- /.github/workflows/gosum.yml: -------------------------------------------------------------------------------- 1 | name: gosum 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | paths: 8 | - '.github/workflows/gosum.yml' 9 | - 'go.mod' 10 | - 'go.sum' 11 | 12 | jobs: 13 | fix: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - 17 | name: Checkout 18 | uses: actions/checkout@v2.3.4 19 | - 20 | name: Set up Go 21 | uses: actions/setup-go@v2 22 | with: 23 | go-version: 1.13 24 | - 25 | name: Tidy 26 | run: | 27 | rm -f go.sum 28 | go mod tidy 29 | - 30 | name: Set up Git 31 | env: 32 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 33 | run: | 34 | git config user.name GitHub 35 | git config user.email noreply@github.com 36 | git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git 37 | - 38 | name: Commit and push changes 39 | run: | 40 | git add . 41 | if output=$(git status --porcelain) && [ ! -z "$output" ]; then 42 | git commit --author "github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>" --message "Fix go modules" 43 | git push 44 | fi 45 | -------------------------------------------------------------------------------- /.github/workflows/labels.yml: -------------------------------------------------------------------------------- 1 | name: labels 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | paths: 8 | - '.github/labels.yml' 9 | - '.github/workflows/labels.yml' 10 | 11 | jobs: 12 | labeler: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - 16 | name: Checkout 17 | uses: actions/checkout@v2.3.4 18 | - 19 | name: Run Labeler 20 | uses: crazy-max/ghaction-github-labeler@v3.1.0 21 | -------------------------------------------------------------------------------- /.github/workflows/released.yml: -------------------------------------------------------------------------------- 1 | name: released 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | virustotal: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - 12 | name: Prepare 13 | id: prepare 14 | run: | 15 | echo ::set-output name=date::$(date -u +'%Y%m%d') 16 | - 17 | name: VirusTotal Monitor Scan 18 | uses: crazy-max/ghaction-virustotal@v2.2.1 19 | with: 20 | vt_api_key: ${{ secrets.VT_MONITOR_API_KEY }} 21 | vt_monitor: true 22 | monitor_path: /portapps/${{ steps.prepare.outputs.date }}/${{ github.event.repository.name }}-${{ github.event.release.tag_name }} 23 | update_release_body: false 24 | github_token: ${{ secrets.GITHUB_TOKEN }} 25 | files: | 26 | ${{ github.event.repository.name }}-(win32|win64).exe 27 | - 28 | name: VirusTotal Scan 29 | uses: crazy-max/ghaction-virustotal@v2.2.1 30 | with: 31 | vt_api_key: ${{ secrets.VT_API_KEY }} 32 | update_release_body: true 33 | github_token: ${{ secrets.GITHUB_TOKEN }} 34 | files: | 35 | ${{ github.event.repository.name }}-(win32|win64).exe 36 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Intellij 2 | /.idea 3 | /*.iml 4 | 5 | # App 6 | /.dev 7 | /bin 8 | /vendor 9 | /*.syso 10 | /*.exe 11 | /versioninfo.json 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | version: ~> 1.0 2 | 3 | os: windows 4 | language: shell 5 | 6 | before_install: 7 | - export PORTAPPS_VERSION=$(cat go.mod | grep github.com/portapps/portapps | awk '{print $NF}') 8 | 9 | import: 10 | - portapps/portapps:.travis/configs/install.yml@v2.6.0 11 | - portapps/portapps:.travis/configs/build.yml@v2.6.0 12 | - portapps/portapps:.travis/configs/set-version.yml@v2.6.0 13 | - portapps/portapps:.travis/configs/git-config.yml@v2.6.0 14 | - portapps/portapps:.travis/configs/deploy.yml@v2.6.0 15 | - portapps/portapps:.travis/configs/notifs.yml@v2.6.0 16 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 19.03.1-6 (2019/08/05) 4 | 5 | * Docker Toolbox 19.03.1 6 | * Git 2.22.0 7 | * Portapps 1.24.1 8 | 9 | ## 18.09.3-5 (2019/03/17) 10 | 11 | * Portapps 1.20.3 12 | 13 | ## 18.09.3-4 (2019/03/05) 14 | 15 | * Docker Toolbox 18.09.3 16 | * Git 2.21.0 17 | 18 | > :warning: **UPGRADE NOTES** 19 | > Configuration file structure has changed, see configuration section on [Docker Toolbox portable page](https://portapps.io/app/docker-toolbox-portable/) for more info. 20 | 21 | ## 18.09.2-2 (2019/02/14) 22 | 23 | * Docker Toolbox 18.09.2 24 | * Git 2.20.1 25 | 26 | ## 18.09.1-1 (2019/02/03) 27 | 28 | * No more win32 release (Issue #2) 29 | 30 | ## 18.09.1-7 (2019/01/15) 31 | 32 | * Docker Toolbox 18.09.1 33 | 34 | ## 18.09.0-6 (2018/11/09) 35 | 36 | * Docker Toolbox 18.09.0 37 | 38 | ## 18.06.1-5 (2018/08/27) 39 | 40 | * Docker Toolbox 18.06.1 41 | 42 | ## 18.06.0-4 (2018/07/23) 43 | 44 | * Docker Toolbox 18.06.0 45 | 46 | ## 18.03.0-3 (2018/04/05) 47 | 48 | * Docker Toolbox 18.03.0 49 | 50 | ## 18.02.0-2 (2018/03/13) 51 | 52 | * Add an option to stop or remove the virtual machine on exit 53 | 54 | ## 18.02.0-1 (2018/03/13) 55 | 56 | * Initial version based on Docker Toolbox 18.02.0 57 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018-2020 CrazyMax 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 | GitHub release 5 | Total downloads 6 | Build Status 7 | Go Report 8 | Code Quality 9 |
Become a sponsor 10 | Donate Paypal 11 |

12 | 13 | ## Notice of Non-Affiliation and Disclaimer 14 | 15 | Portapps is not affiliated, associated, authorized, endorsed by, or in any way officially connected with Docker™, or any of its subsidiaries or its affiliates. 16 | 17 | The official Docker™ website can be found at https://www.docker.com/. 18 | 19 | The name Docker™ as well as related names, marks, emblems and images are registered trademarks of their respective owners. 20 | 21 | ## About 22 | 23 | Docker™ Toolbox portable app made with 🚀 [Portapps](https://portapps.io).
24 | Documentation and downloads can be found on https://portapps.io/app/docker-toolbox-portable/ 25 | 26 | ## How can I help ? 27 | 28 | All kinds of contributions are welcome :raised_hands:! The most basic way to show your support is to star :star2: the project, or to raise issues :speech_balloon: You can also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) :clap: or by making a [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely! :rocket: 29 | 30 | Thanks again for your support, it is much appreciated! :pray: 31 | 32 | ## License 33 | 34 | MIT. See `LICENSE` for more details.
35 | Rocket icon credit to [Squid Ink](http://thesquid.ink). 36 | -------------------------------------------------------------------------------- /build.properties: -------------------------------------------------------------------------------- 1 | # Portapps 2 | core.dir = ../portapps 3 | 4 | # Go 5 | go.ldflags = "" 6 | 7 | # App 8 | app = docker-toolbox 9 | app.name = Docker Toolbox 10 | app.type = innosetup 11 | app.version = 19.03.1 12 | app.release = 6 13 | app.homepage = https://docs.docker.com/toolbox/overview 14 | 15 | # Portable app 16 | papp.id = ${app}-portable 17 | papp.guid = {48C915A3-3093-45D4-B92B-E9D1EE94AFD3} 18 | papp.name = ${app.name} Portable 19 | papp.desc = ${app.name} portable on Windows by Portapps 20 | papp.url = https://github.com/portapps/${papp.id} 21 | papp.folder = app 22 | 23 | papp.git.version = 2.22.0 24 | papp.git.url = https://github.com/git-for-windows/git/releases/download/v${papp.git.version}.windows.1/PortableGit-${papp.git.version}-64-bit.7z.exe 25 | 26 | # InnoSetup 27 | innosetup.app = app 28 | 29 | # Official artifacts 30 | atf.id = DockerToolbox 31 | atf.win64.filename = ${atf.id}-${app.version} 32 | atf.win64.ext = .exe 33 | atf.win64.url = https://github.com/docker/toolbox/releases/download/v${app.version}/DockerToolbox-${app.version}.exe 34 | atf.win64.assertextract = ${innosetup.app}/docker-machine.exe 35 | -------------------------------------------------------------------------------- /build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/portapps/docker-toolbox-portable 2 | 3 | go 1.13 4 | 5 | require github.com/portapps/portapps/v2 v2.6.0 6 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/akavel/rsrc v0.8.0 h1:zjWn7ukO9Kc5Q62DOJCcxGpXC18RawVtYAGdz2aLlfw= 2 | github.com/akavel/rsrc v0.8.0/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= 3 | github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= 4 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 5 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 6 | github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= 7 | github.com/ilya1st/rotatewriter v0.0.0-20171126183947-3df0c1a3ed6d h1:OGuVAVny/97zsQ5BWg0mOjzTBBD9zR+Lug1co144+rU= 8 | github.com/ilya1st/rotatewriter v0.0.0-20171126183947-3df0c1a3ed6d/go.mod h1:S1q6q+21PRGd0WRX+fHjQ+TOe3CgpSv7zgCWnZcbxCs= 9 | github.com/josephspurrier/goversioninfo v1.2.0 h1:tpLHXAxLHKHg/dCU2AAYx08A4m+v9/CWg6+WUvTF4uQ= 10 | github.com/josephspurrier/goversioninfo v1.2.0/go.mod h1:AGP2a+Y/OVJZ+s6XM4IwFUpkETwvn0orYurY8qpw1+0= 11 | github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= 12 | github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= 13 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 14 | github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= 15 | github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= 16 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 17 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 18 | github.com/portapps/portapps/v2 v2.6.0 h1:KpP4pSgPsp8+C4qKtzaXhsD9j/JWG0qssB+a8foNVNA= 19 | github.com/portapps/portapps/v2 v2.6.0/go.mod h1:Hw1Esqanm/0Xx5zYlDFvys7pj6JzYL0xYQ6Fu/lfoRg= 20 | github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ= 21 | github.com/rs/zerolog v1.19.0 h1:hYz4ZVdUgjXTBUmrkrw55j1nHx68LfOKIQk5IYtyScg= 22 | github.com/rs/zerolog v1.19.0/go.mod h1:IzD0RJ65iWH0w97OQQebJEvTZYvsCUm9WVLWBQrJRjo= 23 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 24 | github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= 25 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 26 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= 27 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= 28 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 29 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 30 | golang.org/x/sys v0.0.0-20200806125547-5acd03effb82 h1:6cBnXxYO+CiRVrChvCosSv7magqTPbyAgz1M8iOv5wM= 31 | golang.org/x/sys v0.0.0-20200806125547-5acd03effb82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 32 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 33 | golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= 34 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= 35 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 36 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 37 | gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= 38 | gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 39 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 40 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 41 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | //go:generate go install -v github.com/josephspurrier/goversioninfo/cmd/goversioninfo 2 | //go:generate goversioninfo -icon=res/papp.ico -manifest=res/papp.manifest 3 | package main 4 | 5 | import ( 6 | "fmt" 7 | "os" 8 | "strconv" 9 | "syscall" 10 | 11 | "github.com/portapps/portapps/v2" 12 | "github.com/portapps/portapps/v2/pkg/log" 13 | "github.com/portapps/portapps/v2/pkg/proc" 14 | "github.com/portapps/portapps/v2/pkg/utl" 15 | ) 16 | 17 | type config struct { 18 | Machine machine `yaml:"machine" mapstructure:"machine"` 19 | } 20 | 21 | type machine struct { 22 | Name string `yaml:"name" mapstructure:"name"` 23 | HostCIDR string `yaml:"host_cidr" mapstructure:"host_cidr"` 24 | CPU int `yaml:"cpu" mapstructure:"cpu"` 25 | Ram int `yaml:"ram" mapstructure:"ram"` 26 | Disk int `yaml:"disk" mapstructure:"disk"` 27 | SharedName string `yaml:"shared_name" mapstructure:"shared_name"` 28 | OnExitStop bool `yaml:"on_exit_stop" mapstructure:"on_exit_stop"` 29 | OnExitRemove bool `yaml:"on_exit_remove" mapstructure:"on_exit_remove"` 30 | } 31 | 32 | var ( 33 | app *portapps.App 34 | cfg *config 35 | ) 36 | 37 | func init() { 38 | var err error 39 | 40 | // Default config 41 | cfg = &config{ 42 | Machine: machine{ 43 | Name: "default", 44 | HostCIDR: "192.168.99.1/24", 45 | CPU: 1, 46 | Ram: 1024, 47 | Disk: 20000, 48 | SharedName: "shared", 49 | OnExitStop: false, 50 | OnExitRemove: false, 51 | }, 52 | } 53 | 54 | // Init app 55 | if app, err = portapps.NewWithCfg("docker-toolbox-portable", "Docker Toolbox", cfg); err != nil { 56 | log.Fatal().Err(err).Msg("Cannot initialize application. See log file for more info.") 57 | } 58 | } 59 | 60 | func main() { 61 | utl.CreateFolder(app.DataPath) 62 | app.Process = utl.PathJoin(app.AppPath, "git", "bin", "bash.exe") 63 | app.Args = []string{ 64 | "--login", 65 | "-i", 66 | utl.PathJoin(app.AppPath, "start.sh"), 67 | } 68 | 69 | sharedPath := utl.CreateFolder(app.DataPath, "shared") 70 | storagePath := utl.CreateFolder(app.DataPath, "storage") 71 | 72 | postInstallGit := utl.PathJoin(app.AppPath, "git", "post-install.bat") 73 | if _, err := os.Stat(postInstallGit); err == nil { 74 | log.Info().Msg("Initializing git...") 75 | if err = proc.QuickCmd("cmd", []string{"/k", postInstallGit}); err != nil { 76 | log.Fatal().Err(err).Msg("Cannot initialize git") 77 | } 78 | } 79 | 80 | log.Info().Msg("Setting machine environment...") 81 | utl.OverrideEnv("MACHINE_NAME", cfg.Machine.Name) 82 | utl.OverrideEnv("MACHINE_HOST_CIDR", cfg.Machine.HostCIDR) 83 | utl.OverrideEnv("MACHINE_CPU", strconv.Itoa(cfg.Machine.CPU)) 84 | utl.OverrideEnv("MACHINE_RAM", strconv.Itoa(cfg.Machine.Ram)) 85 | utl.OverrideEnv("MACHINE_DISK", strconv.Itoa(cfg.Machine.Disk)) 86 | utl.OverrideEnv("MACHINE_STORAGE_PATH", utl.FormatUnixPath(storagePath)) 87 | utl.OverrideEnv("MACHINE_SHARED_NAME", cfg.Machine.SharedName) 88 | utl.OverrideEnv("MACHINE_SHARED_PATH", sharedPath) 89 | 90 | log.Info().Msg("Adding app to PATH...") 91 | utl.OverrideEnv("PATH", fmt.Sprintf("%s;%s", app.AppPath, os.Getenv("PATH"))) 92 | 93 | log.Info().Msg("Starting up the shell... ") 94 | pa := os.ProcAttr{ 95 | Files: []*os.File{os.Stdin, os.Stdout, os.Stderr}, 96 | Dir: app.AppPath, 97 | Sys: &syscall.SysProcAttr{ 98 | CmdLine: fmt.Sprintf(` --login -i "%s"`, utl.PathJoin(app.AppPath, "start.sh")), 99 | }, 100 | } 101 | 102 | defer func() { 103 | var exitArgs []string 104 | log.Info().Msg("Exiting...") 105 | 106 | if cfg.Machine.OnExitRemove { 107 | exitArgs = []string{"rm", "-f", cfg.Machine.Name} 108 | } else if cfg.Machine.OnExitStop { 109 | exitArgs = []string{"stop", cfg.Machine.Name} 110 | } 111 | 112 | if len(exitArgs) > 0 { 113 | if err := proc.QuickCmd("docker-machine", exitArgs); err != nil { 114 | log.Error().Err(err).Msg("docker-machine command error") 115 | } 116 | } 117 | }() 118 | 119 | process, err := os.StartProcess(app.Process, []string{}, &pa) 120 | if err != nil { 121 | log.Fatal().Err(err).Msg("Process failed") 122 | } 123 | if _, err := process.Wait(); err != nil { 124 | log.Error().Err(err).Msg("Process failed") 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /res/app.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/portapps/docker-toolbox-portable/d7690c013f574461377f5fad0596495c3e8fbfea/res/app.ico -------------------------------------------------------------------------------- /res/papp.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/portapps/docker-toolbox-portable/d7690c013f574461377f5fad0596495c3e8fbfea/res/papp.ico -------------------------------------------------------------------------------- /res/papp.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /res/papp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/portapps/docker-toolbox-portable/d7690c013f574461377f5fad0596495c3e8fbfea/res/papp.png -------------------------------------------------------------------------------- /res/run.iss: -------------------------------------------------------------------------------- 1 | [Run] 2 | Filename: {app}\{#pappId}.exe; Description: Run {#pappName}; Flags: nowait postinstall skipifsilent unchecked 3 | -------------------------------------------------------------------------------- /res/setup-mini.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/portapps/docker-toolbox-portable/d7690c013f574461377f5fad0596495c3e8fbfea/res/setup-mini.bmp -------------------------------------------------------------------------------- /res/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | trap '[ "$?" -eq 0 ] || read -p "Looks like something went wrong in step ´$STEP´... Press any key to continue..."' EXIT 4 | 5 | DOCKER_MACHINE=./docker-machine.exe 6 | 7 | STEP="Looking for VBoxManage.exe" 8 | if [ ! -z "$VBOX_MSI_INSTALL_PATH" ]; then 9 | VBOXMANAGE="${VBOX_MSI_INSTALL_PATH}VBoxManage.exe" 10 | else 11 | VBOXMANAGE="${VBOX_INSTALL_PATH}VBoxManage.exe" 12 | fi 13 | 14 | BLUE='\033[1;34m' 15 | GREEN='\033[0;32m' 16 | NC='\033[0m' 17 | 18 | #clear all_proxy if not socks address 19 | if [[ $ALL_PROXY != socks* ]]; then 20 | unset ALL_PROXY 21 | fi 22 | if [[ $all_proxy != socks* ]]; then 23 | unset all_proxy 24 | fi 25 | 26 | if [ ! -f "${DOCKER_MACHINE}" ]; then 27 | echo "Docker Machine is not installed." 28 | exit 1 29 | fi 30 | 31 | if [ ! -f "${VBOXMANAGE}" ]; then 32 | echo "VirtualBox is not installed." 33 | exit 1 34 | fi 35 | 36 | "${VBOXMANAGE}" list vms | grep \""${MACHINE_NAME}"\" &> /dev/null 37 | VM_EXISTS_CODE=$? 38 | 39 | set -e 40 | 41 | STEP="Checking if machine $MACHINE_NAME exists" 42 | if [ $VM_EXISTS_CODE -eq 0 -a ! -z ${MACHINE_STORAGE_PATH} -a ! -d "${MACHINE_STORAGE_PATH}/machines/${MACHINE_NAME}" ]; then 43 | "${DOCKER_MACHINE}" rm -f "${MACHINE_NAME}" &> /dev/null || : 44 | fi 45 | if [ $VM_EXISTS_CODE -eq 1 -a ! -z ${MACHINE_STORAGE_PATH} ]; then 46 | "${DOCKER_MACHINE}" rm -f "${MACHINE_NAME}" &> /dev/null || : 47 | rm -rf "${MACHINE_STORAGE_PATH}/machines/${MACHINE_NAME}" 48 | if [ "${HTTP_PROXY}" ]; then 49 | PROXY_ENV="$PROXY_ENV --engine-env HTTP_PROXY=$HTTP_PROXY" 50 | fi 51 | if [ "${HTTPS_PROXY}" ]; then 52 | PROXY_ENV="$PROXY_ENV --engine-env HTTPS_PROXY=$HTTPS_PROXY" 53 | fi 54 | if [ "${NO_PROXY}" ]; then 55 | PROXY_ENV="$PROXY_ENV --engine-env NO_PROXY=$NO_PROXY" 56 | fi 57 | "${DOCKER_MACHINE}" create -d virtualbox $PROXY_ENV \ 58 | --virtualbox-hostonly-cidr "${MACHINE_HOST_CIDR}" \ 59 | --virtualbox-cpu-count "${MACHINE_CPU}" \ 60 | --virtualbox-memory "${MACHINE_RAM}" \ 61 | --virtualbox-disk-size "${MACHINE_DISK}" \ 62 | --virtualbox-share-folder "\\\?\\${MACHINE_SHARED_PATH}:${MACHINE_SHARED_NAME}" \ 63 | "${MACHINE_NAME}" 64 | fi 65 | 66 | STEP="Checking status on $MACHINE_NAME" 67 | VM_STATUS="$( set +e ; ${DOCKER_MACHINE} status ${MACHINE_NAME} )" 68 | if [ "${VM_STATUS}" != "Running" ]; then 69 | "${DOCKER_MACHINE}" start "${MACHINE_NAME}" 70 | yes | "${DOCKER_MACHINE}" regenerate-certs "${MACHINE_NAME}" 71 | fi 72 | 73 | STEP="Setting env" 74 | eval "$(${DOCKER_MACHINE} env --shell=bash --no-proxy ${MACHINE_NAME})" 75 | 76 | STEP="Finalize" 77 | clear 78 | cat << EOF 79 | 80 | 81 | ## . 82 | ## ## ## == 83 | ## ## ## ## ## === 84 | /"""""""""""""""""\___/ === 85 | ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ / ===- ~~~ 86 | \______ o __/ 87 | \ \ __/ 88 | \____\_______/ 89 | 90 | EOF 91 | echo -e "${BLUE}docker${NC} is configured to use the ${GREEN}${MACHINE_NAME}${NC} machine with IP ${GREEN}$(${DOCKER_MACHINE} ip ${MACHINE_NAME})${NC}" 92 | echo -e "Shared folder is named ${BLUE}${MACHINE_SHARED_NAME}${NC} and is located in ${GREEN}data/shared${NC}" 93 | echo "For help getting started, check out the docs at https://docs.docker.com" 94 | echo 95 | cd 96 | 97 | docker () { 98 | MSYS_NO_PATHCONV=1 docker.exe "$@" 99 | } 100 | export -f docker 101 | 102 | if [ $# -eq 0 ]; then 103 | echo "Start interactive shell" 104 | exec "$BASH" --login -i 105 | else 106 | echo "Start shell with command" 107 | exec "$BASH" -c "$*" 108 | fi 109 | --------------------------------------------------------------------------------