aboutsummaryrefslogtreecommitdiff
path: root/mage.go
blob: 9bcc85677d68744cdf3fb92f3e926b35937da3f4 (plain)
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
// +build mage

package main

import (
	"context"

	"github.com/magefile/mage/mg"
)

// Setup installs the tools that other parts of the build process depend on.
func Setup(ctx context.Context) {
	shouldWork(ctx, nil, wd, "go", "get", "-u", "-v", "github.com/GeertJohan/go.rice/rice")
}

// Generate runs all of the code generation.
func Generate(ctx context.Context) {
	shouldWork(ctx, nil, wd, "rice", "embed-go")
}

// Build creates the docker image xena/christine.website using box(1).
func Build() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	shouldWork(ctx, nil, wd, "box", "box.rb")
}

// Deploy does the work needed to deploy this image to the dokku server.
func Deploy(ctx context.Context) error {
	mg.Deps(Build)

	do := func(cmd string, args ...string) {
		shouldWork(ctx, nil, wd, cmd, args...)
	}

	do("docker", "save", "-o", "cw.tar", "xena/christine.website")
	do("scp", "cw.tar", "root@apps.xeserv.us:cw.tar")

	return nil
}