aboutsummaryrefslogtreecommitdiff
path: root/docker.go
blob: 823f4f41b8d6f58c1f069e89082cffa57c7503bf (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
42
43
44
45
46
47
48
49
50
//+build ignore

// Makes the docker image xena/xperimental.
package main

import (
	"context"
	"log"
	"path/filepath"

	"within.website/x/internal/yeet"
)

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	tag := "xena/xperimental"
	yeet.ShouldWork(ctx, nil, yeet.WD, "docker", "build", "-t", tag, ".")

	resTag, err := yeet.DockerTag(ctx, "xena", "xperimental", tag)
	if err != nil {
		log.Fatal(err)
	}
	otherResTag, err := yeet.DockerTag(ctx, "docker.pkg.github.com/xe/x", "xperimental", tag)
	if err != nil {
		log.Fatal(err)
	}

	gitTag, err := yeet.GitTag(ctx)
	if err != nil {
		log.Fatal(err)
	}

	dnsdTag := "xena/dnsd:" + gitTag

	yeet.ShouldWork(ctx, nil, filepath.Join(yeet.WD, "cmd", "dnsd"), "docker", "build", "-t", dnsdTag, "--build-arg", "X_VERSION="+gitTag, ".")
	dnsdGithubTag, err := yeet.DockerTag(ctx, "docker.pkg.github.com/xe/x", "dnsd", dnsdTag)
	if err != nil {
		log.Fatal(err)
	}

	yeet.ShouldWork(ctx, nil, yeet.WD, "docker", "push", resTag)
	yeet.ShouldWork(ctx, nil, yeet.WD, "docker", "push", dnsdTag)
	yeet.ShouldWork(ctx, nil, yeet.WD, "docker", "push", otherResTag)
	yeet.ShouldWork(ctx, nil, yeet.WD, "docker", "push", dnsdGithubTag)

	log.Printf("xperimental: %s %s", resTag, otherResTag)
	log.Printf("dnsd: %s %s", dnsdTag, dnsdGithubTag)
}