File tree 5 files changed +71
-0
lines changed
5 files changed +71
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Add files here to avoid adding them to images when using ADD or COPY
2
+ # See https://docs.docker.com/engine/reference/builder/#dockerignore-file
3
+
4
+ # For example:
5
+ # # comment
6
+ # */temp*
7
+ # */*/temp*
8
+ # temp?
9
+
10
+ .dockerignore
11
+ docker-compose.yaml
12
+ Dockerfile
Original file line number Diff line number Diff line change
1
+ # syntax=docker/dockerfile:1
2
+
3
+ FROM golang:1.20-alpine AS development
4
+
5
+ VOLUME [ "/project" ]
6
+
7
+ WORKDIR /project
8
+
9
+ RUN go install github.com/cosmtrek/air@latest
10
+
11
+ ENTRYPOINT [ "air" ]
12
+
13
+ FROM golang:1.20-alpine AS builder
14
+
15
+ WORKDIR /app
16
+
17
+ COPY go.mod go.sum ./
18
+ RUN go mod download
19
+
20
+ # Copy project files
21
+ # NOTE: For more efficient builds, copy only
22
+ # required files here.
23
+ # For example, for a Go project, you may only
24
+ # need go.mod, go.sum and the actual *.go files
25
+ # that make up your project
26
+ COPY . .
27
+
28
+ RUN CGO_ENABLED=0 GOOS=linux go build -o go-scaffold
29
+
30
+ FROM scratch AS production
31
+
32
+ COPY --from=builder /app/go-scaffold .
33
+
34
+ ENTRYPOINT [ "/go-scaffold" ]
Original file line number Diff line number Diff line change 1
1
version : 3
2
2
3
+ vars :
4
+ VERSION : v0.0.1
5
+
3
6
tasks :
4
7
test :
5
8
cmds :
@@ -29,3 +32,15 @@ tasks:
29
32
cmds :
30
33
- go run . -i testdata/input.json -o testoutput testdata/template
31
34
- tree testoutput
35
+
36
+ docker_build :
37
+ cmds :
38
+ - docker build . -t forrestloomis786/go-scaffold:latest --target production
39
+ - docker build . -t forrestloomis786/go-scaffold:{{.VERSION}} --target production
40
+
41
+ push :
42
+ deps :
43
+ - docker_build
44
+ cmds :
45
+ - docker push forrestloomis786/go-scaffold:latest
46
+ - docker push forrestloomis786/go-scaffold:{{.VERSION}}
Original file line number Diff line number Diff line change
1
+ services :
2
+ dev-app :
3
+ build :
4
+ context : ./
5
+ target : development
6
+ volumes :
7
+ - .:/project
Original file line number Diff line number Diff line change
1
+ services :
2
+ app :
3
+ build : ./
You can’t perform that action at this time.
0 commit comments