restructure to build individual binaries
This commit is contained in:
15
Makefile
15
Makefile
@@ -26,8 +26,7 @@ else
|
|||||||
BUILD_STACK_TARGETS = build-in-docker
|
BUILD_STACK_TARGETS = build-in-docker
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku go-build force
|
.PHONY: all apt-update install version copyfiles man-db plugins dependencies sshcommand plugn docker aufs stack count dokku-installer vagrant-acl-add vagrant-dokku go-build
|
||||||
force :;
|
|
||||||
|
|
||||||
include tests.mk
|
include tests.mk
|
||||||
include deb.mk
|
include deb.mk
|
||||||
@@ -54,7 +53,7 @@ package_cloud:
|
|||||||
packer:
|
packer:
|
||||||
packer build contrib/packer.json
|
packer build contrib/packer.json
|
||||||
|
|
||||||
go-build: force
|
go-build:
|
||||||
basedir=$(PWD); \
|
basedir=$(PWD); \
|
||||||
for dir in plugins/*; do \
|
for dir in plugins/*; do \
|
||||||
if [ -e $$dir/Makefile ]; then \
|
if [ -e $$dir/Makefile ]; then \
|
||||||
@@ -62,6 +61,14 @@ go-build: force
|
|||||||
fi ;\
|
fi ;\
|
||||||
done
|
done
|
||||||
|
|
||||||
|
go-clean:
|
||||||
|
basedir=$(PWD); \
|
||||||
|
for dir in plugins/*; do \
|
||||||
|
if [ -e $$dir/Makefile ]; then \
|
||||||
|
$(MAKE) -C $$dir clean ;\
|
||||||
|
fi ;\
|
||||||
|
done
|
||||||
|
|
||||||
copyfiles:
|
copyfiles:
|
||||||
$(MAKE) go-build || exit 1
|
$(MAKE) go-build || exit 1
|
||||||
cp dokku /usr/local/bin/dokku
|
cp dokku /usr/local/bin/dokku
|
||||||
@@ -81,7 +88,7 @@ copyfiles:
|
|||||||
PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $$plugin ;\
|
PLUGIN_PATH=${CORE_PLUGINS_PATH} plugn enable $$plugin ;\
|
||||||
PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\
|
PLUGIN_PATH=${PLUGINS_PATH} plugn enable $$plugin ;\
|
||||||
done
|
done
|
||||||
find ./plugins/* -type f -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary' | awk -F: '{ print $$1 }' | xargs rm -f
|
$(MAKE) go-clean
|
||||||
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} || true
|
chown dokku:dokku -R ${PLUGINS_PATH} ${CORE_PLUGINS_PATH} || true
|
||||||
$(MAKE) addman
|
$(MAKE) addman
|
||||||
|
|
||||||
|
|||||||
2
plugins/repo/.gitignore
vendored
Normal file
2
plugins/repo/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
/commands
|
||||||
|
/subcommands/*
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
.PHONY: build-in-docker build clean
|
.PHONY: build-in-docker build clean
|
||||||
|
|
||||||
|
GO_REPO_ROOT ?= /go/src/github.com/dokku/dokku
|
||||||
|
BUILD_IMAGE ?= golang:1.7.1
|
||||||
|
|
||||||
build-in-docker: clean
|
build-in-docker: clean
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
-v $$PWD/../..:$(GO_REPO_ROOT) \
|
-v $$PWD/../..:$(GO_REPO_ROOT) \
|
||||||
@@ -7,8 +10,17 @@ build-in-docker: clean
|
|||||||
$(BUILD_IMAGE) \
|
$(BUILD_IMAGE) \
|
||||||
bash -c "make build" || exit $$?
|
bash -c "make build" || exit $$?
|
||||||
|
|
||||||
build:
|
build: commands subcommands
|
||||||
cd src && go build -a -o ../commands
|
subcommands: subcommands/gc subcommands/purge-cache
|
||||||
|
|
||||||
|
commands: **/**/commands.go
|
||||||
|
go build -a -o commands src/commands/commands.go
|
||||||
|
|
||||||
|
subcommands/gc: **/**/**/gc.go
|
||||||
|
go build -a -o subcommands/gc src/subcommands/gc/gc.go
|
||||||
|
|
||||||
|
subcommands/purge-cache: **/**/**/purge-cache.go
|
||||||
|
go build -a -o subcommands/purge-cache src/subcommands/purge-cache/purge-cache.go
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f commands
|
rm -rf commands subcommands
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
[[ " help repo:help " == *" $1 "* ]] || exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
|
||||||
source "$PLUGIN_AVAILABLE_PATH/repo/internal-functions"
|
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|
||||||
|
|
||||||
case "$1" in
|
|
||||||
help | repo:help)
|
|
||||||
repo_help_cmd "$@"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
|
||||||
exit "$DOKKU_NOT_IMPLEMENTED_EXIT"
|
|
||||||
;;
|
|
||||||
|
|
||||||
esac
|
|
||||||
@@ -33,10 +33,6 @@ func main() {
|
|||||||
usage()
|
usage()
|
||||||
case "help":
|
case "help":
|
||||||
fmt.Print(helpContent)
|
fmt.Print(helpContent)
|
||||||
case "repo:gc":
|
|
||||||
gitGC()
|
|
||||||
case "repo:purge-cache":
|
|
||||||
purgeCache()
|
|
||||||
default:
|
default:
|
||||||
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
dokkuNotImplementExitCode, err := strconv.Atoi(os.Getenv("DOKKU_NOT_IMPLEMENTED_EXIT"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// runs 'git gc --aggressive' against the application's repo
|
// runs 'git gc --aggressive' against the application's repo
|
||||||
func gitGC() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
appName := flag.Arg(1)
|
appName := flag.Arg(1)
|
||||||
if appName == "" {
|
if appName == "" {
|
||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// deletes the contents of the build cache stored in the repository
|
// deletes the contents of the build cache stored in the repository
|
||||||
func purgeCache() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
appName := flag.Arg(1)
|
appName := flag.Arg(1)
|
||||||
if appName == "" {
|
if appName == "" {
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
|
||||||
source "$PLUGIN_CORE_AVAILABLE_PATH/common/functions"
|
|
||||||
|
|
||||||
repo_gc() {
|
|
||||||
declare desc="runs 'git gc --aggressive' against the application's repo"
|
|
||||||
local cmd="repo:gc"
|
|
||||||
[[ -z $2 ]] && dokku_log_fail "Please specify an app to run the command on"
|
|
||||||
local APP="$2"; local APP_DIR="$DOKKU_ROOT/$APP"
|
|
||||||
verify_app_name "$APP"
|
|
||||||
|
|
||||||
GIT_DIR="$APP_DIR" git gc --aggressive
|
|
||||||
}
|
|
||||||
|
|
||||||
repo_gc "$@"
|
|
||||||
Reference in New Issue
Block a user