{
    "variables": {
        "version": "55",
        "cwd": "{{env `PWD`}}",
        "local-artefact-dir": "artefacts",
        "container-dir": "/minecraft",
        "user": "minecraft",
        "uid": "10000",
        "group": "minecraft",
        "gid": "10000"
    },
    "builders": [
        {
            "type": "docker",
            "image": "alpine:3.5",
            "pull": false,
            "discard": true,
            "run_command": [ "-d", "-i", "-t", "{{.Image}}", "/bin/sh" ],
            "changes": [ "USER {{user `user`}}" ]
        }
    ],
    "provisioners": [
        {
            "type": "shell",
            "inline": [
                "apk --no-cache --update upgrade",
                "apk --no-cache add ca-certificates wget openjdk8 maven git bash",
                "update-ca-certificates --fresh",
                "addgroup -g {{user `gid`}} {{user `group`}} && adduser -u {{user `uid`}} -D -G {{user `group`}} -h {{user `container-dir`}} -s /bin/bash {{user `user`}}",
                "su -c 'git clone https://hub.spigotmc.org/stash/scm/spigot/buildtools.git; cd buildtools; export JAVA_HOME=/usr; mvn -B -f ./pom.xml clean install' - {{user `user`}}"
            ]
        },
        {
            "type": "file",
            "direction": "download",
            "source": "{{user `container-dir`}}/buildtools/target/BuildTools.jar",
            "destination": "./{{user `local-artefact-dir`}}/"
        }
    ]
}

Add Packer config for building the BuildTools
Add Packer config for building the BuildTools
