-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
66 lines (59 loc) · 2.27 KB
/
Taskfile.yml
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
version: "3"
tasks:
# go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
generate-openapi:
sources:
- openapi/packages.yaml
generates:
- internal/openapi/api.gen.go
cmds:
- mkdir -p internal/openapi
- oapi-codegen -package api -o internal/openapi/api.gen.go openapi/packages.yaml
#- oapi-codegen -generate types -package api -o internal/openapi/types.gen.go openapi/packages.yaml
#- oapi-codegen -generate client -package api -o internal/openapi/client.gen.go openapi/packages.yaml
#- oapi-codegen -generate server -package api -o internal/openapi/server.gen.go openapi/packages.yaml
# - docker run -it --rm -v $PWD:/local openapitools/openapi-generator-cli generate \
# -i openapi/packages.yaml \
# -g go \
# -o /local/gen/packages
build:
env:
CGO_ENABLED: 0
cmds:
- go build ./cmd/api
test:
cmds:
- go test ./cmd/api ./internal/openapi
# build and push the latest, sha, and version tag
# this only gets run on tags
docker:release-prod:
deps: [generate-openapi]
cmds:
- |
docker build \
--pull \
-f Dockerfile \
--tag ghcr.io/atlascloud/packages:latest \
--tag ghcr.io/atlascloud/packages:$GITHUB_SHA \
--tag ghcr.io/atlascloud/packages:$GITHUB_REF \
--cache-from ghcr.io/atlascloud/packages:latest .
- docker push ghcr.io/atlascloud/packages --all-tags
# push with just the sha tagged (no latest or version)
# this gets run on every push
# this has a soft dep on the build step, but I don't want to set it here in
# case I decide to split these docker steps into separate file(s)
docker:push-sha:
cmds:
- docker build --pull -f Dockerfile --tag ghcr.io/atlascloud/packages:$GITHUB_SHA --cache-from ghcr.io/atlascloud/packages:latest .
- docker push ghcr.io/atlascloud/packages:$GITHUB_SHA
docker:build:
deps: [generate-openapi]
cmds:
- docker build -f Dockerfile.local -t packages .
docker:run:
deps: [docker:build]
cmds:
# 8008 is a special port on chromebooks
# https://www.reddit.com/r/Crostini/wiki/index/well-known-ports
- docker run -it --rm -v $(pwd):/app -v /srv/packages:/srv/packages -p 8888:8888 packages