tangled
alpha
login
or
join now
tom.sherman.is
/
piper
0
fork
atom
A fork of https://github.com/teal-fm/piper
0
fork
atom
overview
issues
pulls
pipelines
play with build system
Natalie B
10 months ago
23936cf0
92c42929
+95
-37
4 changed files
expand all
collapse all
unified
split
.air.toml
.github
workflows
build.yaml
Dockerfile
cmd
main.go
+37
-37
.air.toml
···
3
3
tmp_dir = "tmp"
4
4
5
5
[build]
6
6
-
args_bin = []
7
7
-
bin = "./tmp/main"
8
8
-
cmd = "go build -o ./tmp/main ."
9
9
-
delay = 1000
10
10
-
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
11
11
-
exclude_file = []
12
12
-
exclude_regex = ["_test.go"]
13
13
-
exclude_unchanged = false
14
14
-
follow_symlink = false
15
15
-
full_bin = ""
16
16
-
include_dir = []
17
17
-
include_ext = ["go", "tpl", "tmpl", "html"]
18
18
-
include_file = []
19
19
-
kill_delay = "0s"
20
20
-
log = "build-errors.log"
21
21
-
poll = false
22
22
-
poll_interval = 0
23
23
-
post_cmd = []
24
24
-
pre_cmd = []
25
25
-
rerun = false
26
26
-
rerun_delay = 500
27
27
-
send_interrupt = false
28
28
-
stop_on_error = false
6
6
+
args_bin = []
7
7
+
bin = "./tmp/main"
8
8
+
cmd = "go build -o ./tmp/main ./cmd/main.go"
9
9
+
delay = 1000
10
10
+
exclude_dir = ["assets", "tmp", "vendor", "testdata"]
11
11
+
exclude_file = []
12
12
+
exclude_regex = ["_test.go"]
13
13
+
exclude_unchanged = false
14
14
+
follow_symlink = false
15
15
+
full_bin = ""
16
16
+
include_dir = []
17
17
+
include_ext = ["go", "tpl", "tmpl", "html"]
18
18
+
include_file = []
19
19
+
kill_delay = "0s"
20
20
+
log = "build-errors.log"
21
21
+
poll = false
22
22
+
poll_interval = 0
23
23
+
post_cmd = []
24
24
+
pre_cmd = []
25
25
+
rerun = false
26
26
+
rerun_delay = 500
27
27
+
send_interrupt = false
28
28
+
stop_on_error = false
29
29
30
30
[color]
31
31
-
app = ""
32
32
-
build = "yellow"
33
33
-
main = "magenta"
34
34
-
runner = "green"
35
35
-
watcher = "cyan"
31
31
+
app = ""
32
32
+
build = "yellow"
33
33
+
main = "magenta"
34
34
+
runner = "green"
35
35
+
watcher = "cyan"
36
36
37
37
[log]
38
38
-
main_only = false
39
39
-
silent = false
40
40
-
time = false
38
38
+
main_only = false
39
39
+
silent = false
40
40
+
time = false
41
41
42
42
[misc]
43
43
-
clean_on_exit = false
43
43
+
clean_on_exit = false
44
44
45
45
[proxy]
46
46
-
app_port = 0
47
47
-
enabled = false
48
48
-
proxy_port = 0
46
46
+
app_port = 0
47
47
+
enabled = false
48
48
+
proxy_port = 0
49
49
50
50
[screen]
51
51
-
clear_on_rebuild = false
52
52
-
keep_scroll = true
51
51
+
clear_on_rebuild = false
52
52
+
keep_scroll = true
+34
.github/workflows/build.yaml
···
1
1
+
name: Build
2
2
+
3
3
+
on:
4
4
+
push:
5
5
+
branches:
6
6
+
- main
7
7
+
release:
8
8
+
types:
9
9
+
- published
10
10
+
11
11
+
jobs:
12
12
+
build-and-deploy:
13
13
+
runs-on: ubuntu-latest
14
14
+
15
15
+
steps:
16
16
+
- name: Checkout Repository
17
17
+
uses: actions/checkout@v2
18
18
+
19
19
+
- name: Set up Docker Buildx
20
20
+
uses: docker/setup-buildx-action@v3
21
21
+
22
22
+
- name: Login to GitHub Container Registry
23
23
+
uses: docker/login-action@v1
24
24
+
with:
25
25
+
registry: ghcr.io
26
26
+
username: ${{ github.actor }}
27
27
+
password: ${{ secrets.GITHUB_TOKEN }}
28
28
+
29
29
+
- name: Docker Buildx
30
30
+
run: |
31
31
+
docker buildx build \
32
32
+
--platform linux/amd64,linux/arm64 \
33
33
+
--tag ghcr.io/${{ github.repository_owner }}/piper:${GITHUB_REF_NAME#refs/tags/v} \
34
34
+
--push .
+24
Dockerfile
···
1
1
+
FROM --platform=${BUILDPLATFORM:-linux/amd64} golang:latest as builder
2
2
+
3
3
+
ARG TARGETPLATFORM
4
4
+
ARG BUILDPLATFORM
5
5
+
ARG TARGETOS
6
6
+
ARG TARGETARCH
7
7
+
8
8
+
# step 1. dep cache
9
9
+
WORKDIR /app
10
10
+
ARG TARGETPLATFORM=${BUILDPLATFORM:-linux/amd64}
11
11
+
COPY go.mod go.sum ./
12
12
+
RUN go mod download
13
13
+
14
14
+
# step 2. build the actual app
15
15
+
WORKDIR /app
16
16
+
COPY . .
17
17
+
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build -ldflags="-w -s" -o main ./cmd/main.go
18
18
+
ARG TARGETOS=${TARGETPLATFORM%%/*}
19
19
+
ARG TARGETARCH=${TARGETPLATFORM##*/}
20
20
+
21
21
+
FROM --platform=${TARGETPLATFORM:-linux/amd64} scratch
22
22
+
WORKDIR /app/
23
23
+
COPY --from=builder /app/main /app/main
24
24
+
ENTRYPOINT ["/app/main"]
main.go
cmd/main.go