-
-
+ |
+
|
diff --git a/apps/comms/email-templates/account-invite/email.mjml b/apps/comms/email-templates/account-invite/email.mjml
index 8e73ae372..4c2d291a7 100644
--- a/apps/comms/email-templates/account-invite/email.mjml
+++ b/apps/comms/email-templates/account-invite/email.mjml
@@ -3,7 +3,8 @@
-
+
+
Hello {{.Name}},
diff --git a/apps/comms/email-templates/project-invite/email.html b/apps/comms/email-templates/project-invite/email.html
index caf64ad1a..4fd6afbd1 100644
--- a/apps/comms/email-templates/project-invite/email.html
+++ b/apps/comms/email-templates/project-invite/email.html
@@ -1,6 +1,6 @@
-
+
@@ -105,13 +105,14 @@
+
-
-
+ |
+
|
diff --git a/apps/comms/email-templates/project-invite/email.mjml b/apps/comms/email-templates/project-invite/email.mjml
index c88446d1b..5883d4b93 100644
--- a/apps/comms/email-templates/project-invite/email.mjml
+++ b/apps/comms/email-templates/project-invite/email.mjml
@@ -3,7 +3,9 @@
-
+
+
+
Hello {{.Name}},
diff --git a/apps/comms/email-templates/reset-password/email.html b/apps/comms/email-templates/reset-password/email.html
index 89d522fe3..dea71cb51 100644
--- a/apps/comms/email-templates/reset-password/email.html
+++ b/apps/comms/email-templates/reset-password/email.html
@@ -1,6 +1,6 @@
-
+
@@ -105,13 +105,14 @@
+
-
-
+ |
+
|
diff --git a/apps/comms/email-templates/reset-password/email.mjml b/apps/comms/email-templates/reset-password/email.mjml
index 39d284973..751f61e86 100644
--- a/apps/comms/email-templates/reset-password/email.mjml
+++ b/apps/comms/email-templates/reset-password/email.mjml
@@ -3,7 +3,9 @@
-
+
+
+
Hello {{.Name}},
diff --git a/apps/comms/email-templates/user-verification/email.html b/apps/comms/email-templates/user-verification/email.html
index 5ec94ff21..ec932259b 100644
--- a/apps/comms/email-templates/user-verification/email.html
+++ b/apps/comms/email-templates/user-verification/email.html
@@ -1,6 +1,6 @@
-
+
@@ -105,13 +105,14 @@
+
-
+
|
diff --git a/apps/comms/email-templates/user-verification/email.mjml b/apps/comms/email-templates/user-verification/email.mjml
index aed5fdb6f..67b47a77d 100644
--- a/apps/comms/email-templates/user-verification/email.mjml
+++ b/apps/comms/email-templates/user-verification/email.mjml
@@ -1,9 +1,11 @@
+
-
+
+
diff --git a/apps/comms/email-templates/welcome/email.html b/apps/comms/email-templates/welcome/email.html
index 5a1b06be8..2d35f312a 100644
--- a/apps/comms/email-templates/welcome/email.html
+++ b/apps/comms/email-templates/welcome/email.html
@@ -1,5 +1,6 @@
+
-
+
@@ -102,13 +103,14 @@
+
-
-
+ |
+
|
diff --git a/apps/comms/email-templates/welcome/email.mjml b/apps/comms/email-templates/welcome/email.mjml
index 9b1739f1f..06e1f11da 100644
--- a/apps/comms/email-templates/welcome/email.mjml
+++ b/apps/comms/email-templates/welcome/email.mjml
@@ -1,9 +1,11 @@
+
-
+
+
diff --git a/apps/console/.dockerignore b/apps/console/.dockerignore
index b30fec26f..d23381b64 100644
--- a/apps/console/.dockerignore
+++ b/apps/console/.dockerignore
@@ -1,3 +1,2 @@
**
-!main.go
-!internal
+!bin
diff --git a/apps/console/Containerfile.local b/apps/console/Containerfile
similarity index 57%
rename from apps/console/Containerfile.local
rename to apps/console/Containerfile
index f989f68fd..fd35b0c8e 100644
--- a/apps/console/Containerfile.local
+++ b/apps/console/Containerfile
@@ -1,6 +1,5 @@
#syntax=docker/dockerfile:1
FROM gcr.io/distroless/static-debian11:nonroot
-WORKDIR /app
-ARG APP
-COPY --from=local-builder --chown=1001 $APP ./console
+ARG BINARY
+COPY --chown=1001 ./bin/$BINARY ./console
ENTRYPOINT ["./console"]
diff --git a/apps/console/Dockerfile b/apps/console/Dockerfile
deleted file mode 100644
index f9e277e55..000000000
--- a/apps/console/Dockerfile
+++ /dev/null
@@ -1,22 +0,0 @@
-# syntax=docker/dockerfile:1.4
-FROM golang:1.18.3-alpine3.16 AS base
-USER 1001
-ENV GOPATH=/tmp/go
-ENV GOCACHE=/tmp/go-cache
-WORKDIR /tmp/app
-COPY --chown=1001 --from=project-root ./go.mod ./go.sum ./tools.go ./
-RUN go mod download -x
-COPY --chown=1001 --from=project-root common ./common
-COPY --chown=1001 --from=project-root grpc-interfaces ./grpc-interfaces
-COPY --chown=1001 --from=project-root pkg ./pkg
-ARG APP
-RUN mkdir -p ./apps/$APP
-WORKDIR /tmp/app/apps/$APP
-COPY --chown=1001 ./ ./
-RUN CGO_ENABLED=0 go build -o /tmp/bin/$APP ./main.go
-RUN chmod +x /tmp/bin/$APP
-
-FROM gcr.io/distroless/static-debian11:nonroot
-ARG APP
-COPY --from=base --chown=1001 /tmp/bin/$APP ./console
-CMD ["./console"]
diff --git a/apps/console/Taskfile.yml b/apps/console/Taskfile.yml
index c2c668b7c..81ce07b47 100644
--- a/apps/console/Taskfile.yml
+++ b/apps/console/Taskfile.yml
@@ -1,10 +1,10 @@
version: "3"
-dotenv:
- - .secrets/env
-
vars:
- ImagePrefix: "ghcr.io/kloudlite/api"
+ app: console
+
+includes:
+ go: ../../.tools/taskfiles/go-build.yml
tasks:
gql:
@@ -13,23 +13,6 @@ tasks:
- go run github.com/99designs/gqlgen generate
- gofmt -w -d -r '"errors" -> "github.com/kloudlite/api/pkg/errors"' graph/*.resolvers.go
-
- build:
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- vars:
- BuiltAt:
- sh: date | sed 's/\s/_/g'
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
- cmds:
- - go generate ./internal/entities/field-constants/
- - go build -ldflags="-s -w -X github.com/kloudlite/api/common.BuiltAt=\"{{.BuiltAt}}\"" -o {{.Out}}
- - upx {{.Out}}
-
k8s-schema:
cmds:
- mkdir -p "./internal/app/_struct-to-graphql"
@@ -60,40 +43,25 @@ tasks:
popd
- rm -rf ./internal/app/_struct-to-graphql
- docker-build:
- vars:
- APP: console
- IMAGE: "{{.ImagePrefix}}/{{.APP}}:{{.Tag}}"
- preconditions:
- - sh: '[[ -n "{{.Tag}}" ]]'
- msg: 'var Tag must have a value'
- cmds:
- - docker buildx build -f ./Dockerfile -t {{.IMAGE}} . --build-arg APP={{.APP}} --platform linux/amd64 --build-context project-root=../..
- - docker push {{.IMAGE}}
-
- local-build:
- vars:
- APP: console
- IMAGE: "{{.ImagePrefix}}/{{.APP}}:{{.Tag}}"
- preconditions:
- - sh: '[[ -n "{{.Tag}}" ]]'
- msg: 'var Tag must have a value'
- silent: true
- cmds:
- - |+
- tdir=$(mktemp -d)
- task build Out=$tdir/{{.APP}}
-
- podman buildx build -f ./Containerfile.local -t {{.IMAGE}} . --build-context local-builder=${tdir} --build-arg APP="{{.APP}}"
- podman push {{.IMAGE}}
- rm -rf $tdir
-
run:
- vars:
- Name: console
dotenv:
- .secrets/env
env:
CGO_ENABLED: 0
cmds:
- go run ./main.go --dev
+
+ build:
+ cmds:
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
+
+ container:build-and-push:
+ preconditions:
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
+ cmds:
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
+
diff --git a/apps/container-registry/.dockerignore b/apps/container-registry/.dockerignore
index c33b5ad2b..d23381b64 100644
--- a/apps/container-registry/.dockerignore
+++ b/apps/container-registry/.dockerignore
@@ -1,4 +1,2 @@
**
-!main.go
-!internal
-!templates
+!bin
diff --git a/apps/container-registry/Containerfile b/apps/container-registry/Containerfile
new file mode 100644
index 000000000..159536c02
--- /dev/null
+++ b/apps/container-registry/Containerfile
@@ -0,0 +1,4 @@
+FROM gcr.io/distroless/static-debian12:nonroot
+ARG BINARY
+COPY ./bin/${BINARY} ./container-registry
+ENTRYPOINT ["./container-registry"]
diff --git a/apps/container-registry/Containerfile.local b/apps/container-registry/Containerfile.local
deleted file mode 100644
index 95e620786..000000000
--- a/apps/container-registry/Containerfile.local
+++ /dev/null
@@ -1,5 +0,0 @@
-FROM gcr.io/distroless/static-debian12:nonroot
-ARG binpath
-COPY --from=local-builder ${binpath} /container-registry
-COPY templates /templates
-CMD ["/container-registry"]
diff --git a/apps/container-registry/Dockerfile b/apps/container-registry/Dockerfile
deleted file mode 100644
index 90ecb5ac7..000000000
--- a/apps/container-registry/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-# syntax=docker/dockerfile:1.4
-FROM golang:1.18.3-alpine3.16 AS base
-USER 1001
-ENV GOPATH=/tmp/go
-ENV GOCACHE=/tmp/go-cache
-WORKDIR /tmp/app
-COPY --chown=1001 --from=project-root ./go.mod ./go.sum ./tools.go ./
-RUN go mod download -x
-COPY --chown=1001 --from=project-root common ./common
-COPY --chown=1001 --from=project-root grpc-interfaces ./grpc-interfaces
-COPY --chown=1001 --from=project-root pkg ./pkg
-ARG APP
-RUN mkdir -p ./apps/$APP
-WORKDIR /tmp/app/apps/$APP
-COPY --chown=1001 ./ ./
-RUN CGO_ENABLED=0 go build -tags musl -o /tmp/bin/$APP ./main.go
-RUN chmod +x /tmp/bin/$APP
-
-FROM gcr.io/distroless/static-debian11
-ARG APP
-COPY --from=base --chown=1001 /tmp/bin/$APP /container-registry
-COPY templates /templates
-CMD ["/container-registry"]
diff --git a/apps/container-registry/Taskfile.yml b/apps/container-registry/Taskfile.yml
index 5e97bdea2..78f713a25 100644
--- a/apps/container-registry/Taskfile.yml
+++ b/apps/container-registry/Taskfile.yml
@@ -1,10 +1,10 @@
version: "3"
-dotenv:
- - .secrets/env
-
vars:
- ImagePrefix: "ghcr.io/kloudlite/platform/apis"
+ app: container-registry
+
+includes:
+ go: ../../.tools/taskfiles/go-build.yml
tasks:
gql:
@@ -13,21 +13,6 @@ tasks:
- go run -tags dynamic github.com/99designs/gqlgen generate
- gofmt -w -d -r '"errors" -> "github.com/kloudlite/api/pkg/errors"' graph/*.resolvers.go
- build:
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- vars:
- BuiltAt:
- sh: date | sed 's/\s/_/g'
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
- cmds:
- - go build -v -ldflags="-s -w -X github.com/kloudlite/api/common.BuiltAt=\"{{.BuiltAt}}\"" -o {{.Out}}
- - upx {{.Out}}
-
k8s-schema:
cmds:
- mkdir -p "./internal/app/_struct-to-graphql"
@@ -54,47 +39,25 @@ tasks:
popd
- rm -rf ./internal/app/_struct-to-graphql
- docker-build:
- vars:
- APP: container-registry
- IMAGE: registry.kloudlite.io/kloudlite/{{.EnvName}}/{{.APP}}-api:{{.Tag}}
- preconditions:
- - sh: '[[ -n "{{.Tag}}" ]]'
- msg: 'var Tag must have a value'
-
- - sh: '[[ "{{.EnvName}}" == "development" ]] || [[ "{{.EnvName}}" == "staging" ]] || [[ "{{.EnvName}}" == "production" ]]'
- msg: 'var EnvName must have one of [development, staging, production] as its value'
- cmds:
- - docker buildx build -f ./Dockerfile -t {{.IMAGE}} . --build-arg APP={{.APP}} --platform linux/amd64 --build-context project-root=../..
- - docker push {{.IMAGE}}
-
-
- local-build:
- preconditions:
- - sh: '[ -n "{{.Tag}}" ]'
- msg: 'var Tag must have a value'
- vars:
- APP: container-registry
- IMAGE: "{{.ImagePrefix}}/{{.APP}}:{{.Tag}}"
- BUILDER: podman
- silent: true
- cmds:
- - |+
- tDir=$(mktemp -d)
-
- echo "building application ..."
- task build Out=$tDir/{{.APP}}
-
- {{.BUILDER}} buildx build -f Containerfile.local -t {{.IMAGE}} . --build-context local-builder=${tDir} --build-arg binpath={{.APP}}
- {{.BUILDER}} push {{.IMAGE}}
- rm -rf $tDir
-
run:
- vars:
- Name: console
dotenv:
- .secrets/env
env:
CGO_ENABLED: 0
cmds:
- go run ./main.go --dev
+
+ build:
+ cmds:
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
+
+ container:build-and-push:
+ preconditions:
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
+ cmds:
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
+
diff --git a/apps/gateway/Dockerfile b/apps/gateway/Containerfile
similarity index 100%
rename from apps/gateway/Dockerfile
rename to apps/gateway/Containerfile
diff --git a/apps/gateway/Taskfile.yml b/apps/gateway/Taskfile.yml
index 4e6d678e3..531927b91 100644
--- a/apps/gateway/Taskfile.yml
+++ b/apps/gateway/Taskfile.yml
@@ -1,23 +1,21 @@
version: 3
-dotenv:
-- "./.secrets/env"
-
vars:
- ImagePrefix: ghcr.io/kloudlite/platform/apis
+ app: gateway
tasks:
dev:
+ dotenv:
+ - "./.secrets/env"
interactive: true
cmds:
- npm start
- docker-build:
- vars:
- Image: "{{.ImagePrefix}}/gateway:{{.Tag}}"
+
+ container:build-and-push:
preconditions:
- - sh: test -n '{{.Tag}}'
- msg: 'var Tag must be defined'
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
cmds:
- - podman build . -t {{.Image}}
- - podman push {{.Image}}
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --push
+
diff --git a/apps/iam/.dockerignore b/apps/iam/.dockerignore
new file mode 100644
index 000000000..d23381b64
--- /dev/null
+++ b/apps/iam/.dockerignore
@@ -0,0 +1,2 @@
+**
+!bin
diff --git a/apps/iam/Containerfile.local b/apps/iam/Containerfile
similarity index 59%
rename from apps/iam/Containerfile.local
rename to apps/iam/Containerfile
index 5b9fcdec2..8dd8b0e5e 100644
--- a/apps/iam/Containerfile.local
+++ b/apps/iam/Containerfile
@@ -1,6 +1,5 @@
# syntax=docker/dockerfile:1
FROM gcr.io/distroless/static-debian11:nonroot
-WORKDIR /app
-ARG APP
-COPY --from=builder --chown=1001 $APP ./iam
+ARG BINARY
+COPY --chown=1001 ./bin/$BINARY ./iam
ENTRYPOINT ["./iam"]
diff --git a/apps/iam/Taskfile.yml b/apps/iam/Taskfile.yml
index 2df616a24..c2f9e4fd4 100644
--- a/apps/iam/Taskfile.yml
+++ b/apps/iam/Taskfile.yml
@@ -1,55 +1,36 @@
version: 3
-dotenv:
- - .secrets/.env
-
includes:
grpc:
taskfile: ../../grpc-interfaces/Taskfile.yml
dir: ../../grpc-interfaces/
+ go: ../../.tools/taskfiles/go-build.yml
vars:
- ImagePrefix: "ghcr.io/kloudlite/api"
+ app: iam
tasks:
proto:
cmds:
- task: grpc:build
- build:
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- vars:
- BuiltAt:
- sh: date | sed 's/\s/_/g'
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
- cmds:
- - go build -ldflags="-s -w -X kloudlite.io/common.BuiltAt=\"{{.BuiltAt}}\"" -o {{.Out}}
- - upx {{.Out}}
-
run:
dotenv:
- .secrets/env
cmds:
- go run ./main.go
- local-build:
- vars:
- APP: iam
- IMAGE: "{{.ImagePrefix}}/{{.APP}}:{{.Tag}}"
+ build:
+ cmds:
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
+
+ container:build-and-push:
preconditions:
- - sh: '[[ -n "{{.Tag}}" ]]'
- msg: 'var Tag must have a value'
- silent: true
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
cmds:
- - |+
- tdir=$(mktemp -d)
- task build Out=$tdir/{{.APP}}
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
- podman buildx build -f ./Containerfile.local -t {{.IMAGE}} . --build-context builder=${tdir} --build-arg APP="{{.APP}}"
- podman push {{.IMAGE}}
- rm -rf $tdir
diff --git a/apps/infra/.dockerignore b/apps/infra/.dockerignore
index b30fec26f..d23381b64 100644
--- a/apps/infra/.dockerignore
+++ b/apps/infra/.dockerignore
@@ -1,3 +1,2 @@
**
-!main.go
-!internal
+!bin
diff --git a/apps/infra/Containerfile.local b/apps/infra/Containerfile
similarity index 59%
rename from apps/infra/Containerfile.local
rename to apps/infra/Containerfile
index 67ad05bb3..99ccca23a 100644
--- a/apps/infra/Containerfile.local
+++ b/apps/infra/Containerfile
@@ -1,6 +1,5 @@
#syntax=docker/dockerfile:1
FROM gcr.io/distroless/static-debian11:nonroot
-WORKDIR /app
-ARG APP
-COPY --from=builder --chown=1001 $APP ./infra
+ARG BINARY
+COPY --chown=1001 ./bin/${BINARY} ./infra
ENTRYPOINT ["./infra"]
diff --git a/apps/infra/Dockerfile b/apps/infra/Dockerfile
deleted file mode 100644
index 555bd1798..000000000
--- a/apps/infra/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-# syntax=docker/dockerfile:1.4
-FROM golang:1.18.3-alpine3.16 AS base
-USER 1001
-ENV GOPATH=/tmp/go
-ENV GOCACHE=/tmp/go-cache
-WORKDIR /tmp/app
-COPY --chown=1001 --from=project-root ./go.mod ./go.sum ./tools.go ./
-RUN go mod download -x
-COPY --chown=1001 --from=project-root common ./common
-COPY --chown=1001 --from=project-root grpc-interfaces ./grpc-interfaces
-COPY --chown=1001 --from=project-root pkg ./pkg
-ARG APP
-RUN mkdir -p ./apps/$APP
-WORKDIR /tmp/app/apps/$APP
-COPY --chown=1001 ./ ./
-RUN CGO_ENABLED=0 go build -tags musl -o /tmp/bin/$APP ./main.go
-RUN chmod +x /tmp/bin/$APP
-
-FROM gcr.io/distroless/static-debian11:nonroot
-LABEL org.opencontainers.image.source=https://github.com/kloudlite/api
-ARG APP
-COPY --from=base /tmp/bin/${APP} ./infra
-CMD ["./infra"]
diff --git a/apps/infra/Taskfile.yml b/apps/infra/Taskfile.yml
index 7e6be6c01..e082db48d 100644
--- a/apps/infra/Taskfile.yml
+++ b/apps/infra/Taskfile.yml
@@ -1,10 +1,10 @@
version: "3"
-dotenv:
- - .secrets/env
-
vars:
- ImagePrefix: "ghcr.io/kloudlite/api"
+ app: infra
+
+includes:
+ go: ../../.tools/taskfiles/go-build.yml
tasks:
gql:
@@ -13,21 +13,6 @@ tasks:
- go run github.com/99designs/gqlgen generate
- gofmt -w -d -r '"errors" -> "github.com/kloudlite/api/pkg/errors"' graph/*.resolvers.go
- build:
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- vars:
- BuiltAt:
- sh: date | sed 's/\s/_/g'
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
- cmds:
- - go build -ldflags="-s -w -X github.com/kloudlite/api/common.BuiltAt=\"{{.BuiltAt}}\"" -o {{.Out}}
- - upx {{.Out}}
-
k8s-schema:
cmds:
- mkdir -p "./internal/app/_struct-to-graphql"
@@ -54,37 +39,25 @@ tasks:
- rm -rf ./internal/app/_struct-to-graphql
run:
+ dotenv:
+ - .secrets/env
cmds:
- go run main.go --dev
# - go build -o bin/infra . && ./bin/infra --dev
- docker-build:
- vars:
- APP: infra
- IMAGE: registry.kloudlite.io/kloudlite/{{.EnvName}}/{{.APP}}:{{.Tag}}
- preconditions:
- - sh: '[[ -n "{{.Tag}}" ]]'
- msg: 'var Tag must have a value'
- cmds:
- - docker buildx build -f ./Dockerfile -t {{.IMAGE}} . --build-arg APP={{.APP}} --platform linux/amd64 --build-context project-root=../..
- - docker push {{.IMAGE}}
+ build:
+ cmds:
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
- local-build:
+ container:build-and-push:
preconditions:
- - sh: '[ -n "{{.Tag}}" ]'
- msg: 'var Tag must have a value'
- vars:
- APP: infra
- IMAGE: "{{.ImagePrefix}}/{{.APP}}:{{.Tag}}"
- silent: true
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
cmds:
- - |+
- tdir=$(mktemp -d)
- task build Out=$tdir/{{.APP}}
-
- podman buildx build -f ./Containerfile.local -t {{.IMAGE}} . --build-context builder=${tdir} --build-arg APP="{{.APP}}"
- podman push {{.IMAGE}}
- rm -rf $tdir
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
test:
cmds:
diff --git a/apps/message-office/.dockerignore b/apps/message-office/.dockerignore
new file mode 100644
index 000000000..d23381b64
--- /dev/null
+++ b/apps/message-office/.dockerignore
@@ -0,0 +1,2 @@
+**
+!bin
diff --git a/apps/message-office/Containerfile b/apps/message-office/Containerfile
new file mode 100644
index 000000000..bf12a9b7c
--- /dev/null
+++ b/apps/message-office/Containerfile
@@ -0,0 +1,5 @@
+# syntax=docker/dockerfile:1.4
+FROM gcr.io/distroless/static-debian11:nonroot
+ARG BINARY
+COPY --chown=1001 $BINARY ./message-office
+ENTRYPOINT ["./message-office"]
diff --git a/apps/message-office/Containerfile.local b/apps/message-office/Containerfile.local
deleted file mode 100644
index 139e421fc..000000000
--- a/apps/message-office/Containerfile.local
+++ /dev/null
@@ -1,6 +0,0 @@
-# syntax=docker/dockerfile:1.4
-FROM scratch
-WORKDIR /app
-ARG binpath
-COPY --from=local-builder --chown=1001 $binpath ./message-office
-ENTRYPOINT ["./message-office"]
diff --git a/apps/message-office/Dockerfile b/apps/message-office/Dockerfile
deleted file mode 100644
index 2537f0aca..000000000
--- a/apps/message-office/Dockerfile
+++ /dev/null
@@ -1,22 +0,0 @@
-# syntax=docker/dockerfile:1.4
-FROM golang:1.18.3-alpine3.16 AS base
-USER 1001
-ENV GOPATH=/tmp/go
-ENV GOCACHE=/tmp/go-cache
-WORKDIR /tmp/app
-COPY --chown=1001 --from=project-root ./go.mod ./go.sum ./tools.go ./
-RUN go mod download -x
-COPY --chown=1001 --from=project-root common ./common
-COPY --chown=1001 --from=project-root grpc-interfaces ./grpc-interfaces
-COPY --chown=1001 --from=project-root pkg ./pkg
-ARG APP
-RUN mkdir -p ./apps/$APP
-WORKDIR /tmp/app/apps/$APP
-COPY --chown=1001 ./ ./
-RUN CGO_ENABLED=0 go build -tags musl -o /tmp/bin/$APP ./main.go
-RUN chmod +x /tmp/bin/$APP
-
-FROM gcr.io/distroless/static-debian11:nonroot
-ARG APP
-COPY --from=base --chown=1001 /tmp/bin/$APP ./message-office
-CMD ["./message-office"]
diff --git a/apps/message-office/Taskfile.yml b/apps/message-office/Taskfile.yml
index 09c55a45e..906fa47c2 100644
--- a/apps/message-office/Taskfile.yml
+++ b/apps/message-office/Taskfile.yml
@@ -1,7 +1,10 @@
version: 3
vars:
- ImagePrefix: "ghcr.io/kloudlite/api"
+ app: message-office
+
+includes:
+ go: ../../.tools/taskfiles/go-build.yml
tasks:
run:
@@ -14,42 +17,22 @@ tasks:
cmds:
- protoc --go_out=. --go-grpc_out=. --go_opt=paths=import --go-grpc_opt=paths=import ./internal/app/proto/*.proto
-
- build:
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- vars:
- BuiltAt:
- sh: date | sed 's/\s/_/g'
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
- cmds:
- - go build -ldflags="-s -w -X 'kloudlite.io/common.BuiltAt={{.BuiltAt}}'" -o {{.Out}}
- - upx {{.Out}}
-
gql:
dir: internal/app
cmds:
- go run github.com/99designs/gqlgen generate
- local-build:
+ build:
+ cmds:
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
+
+ container:build-and-push:
preconditions:
- - sh: '[ -n "{{.Tag}}" ]'
- msg: 'var Tag must have a value'
- vars:
- APP: message-office
- IMAGE: "{{.ImagePrefix}}/{{.APP}}:{{.Tag}}"
- silent: true
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
cmds:
- - |+
- tDir=$(mktemp -d)
- binpath="{{.APP}}"
- task build Out=$tDir/$binpath
-
- echo "[#] building container image"
- podman buildx build -f ./Containerfile.local -t {{.IMAGE}} . --build-arg binpath="$binpath" --build-context local-builder=${tDir}
- echo "[#] pushing container image"
- podman push {{.IMAGE}}
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
+
diff --git a/apps/tenant-agent/.dockerignore b/apps/tenant-agent/.dockerignore
index bebf98b4b..d23381b64 100644
--- a/apps/tenant-agent/.dockerignore
+++ b/apps/tenant-agent/.dockerignore
@@ -1,4 +1,2 @@
**
-!internal
-!main.go
-!types
+!bin
diff --git a/apps/tenant-agent/Containerfile.local b/apps/tenant-agent/Containerfile
similarity index 56%
rename from apps/tenant-agent/Containerfile.local
rename to apps/tenant-agent/Containerfile
index aed8da8e5..af0a61714 100644
--- a/apps/tenant-agent/Containerfile.local
+++ b/apps/tenant-agent/Containerfile
@@ -1,6 +1,5 @@
# syntax=docker/dockerfile:1.4
FROM gcr.io/distroless/static:nonroot
-WORKDIR /app
-ARG binpath
-COPY --from=local-builder ${binpath} ./kloudlite-agent
+ARG BINARY
+COPY ./bin/${BINARY} ./kloudlite-agent
ENTRYPOINT ["./kloudlite-agent"]
diff --git a/apps/tenant-agent/Taskfile.yml b/apps/tenant-agent/Taskfile.yml
index 8a1862e15..98165d2b4 100644
--- a/apps/tenant-agent/Taskfile.yml
+++ b/apps/tenant-agent/Taskfile.yml
@@ -1,48 +1,33 @@
version: 3
+vars:
+ app: tenant-agent
+
+includes:
+ go: ../../.tools/taskfiles/go-build.yml
+
tasks:
vector:proto:
cmds:
- protoc --go_out=. --go-grpc_out=. --go_opt=paths=import --go-grpc_opt=paths=import ./internal/proto/*.proto
- build:
- env:
- GOOS: linux
- GOARCH: amd64
- CGO_ENABLED: 0
- vars:
- BuiltAt:
- sh: date | sed 's/\s/_/g'
-
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
- cmds:
- - go build -ldflags="-s -w -X 'github.com/kloudlite/api/common.BuiltAt={{.BuiltAt}}'" -o {{.Out}}
-
run:
dotenv:
- .secrets/env
cmds:
- go run . --dev
- local-build:
+ build:
+ cmds:
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
+
+ container:build-and-push:
preconditions:
- - sh: '[ -n "{{.Tag}}" ]'
- msg: 'var Tag must have a value'
- vars:
- Name: tenant-agent
- Image: ghcr.io/kloudlite/api/{{.Name}}:{{.Tag}}
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- silent: true
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
cmds:
- - |+
- task build Out=bin/{{.Name}}
- echo "[#] building container image {{.Image}}"
- podman buildx build -f ./Containerfile.local --build-context local-builder=bin --build-arg binpath=./{{.Name}} -t {{.Image}} .
- echo "[#] pushing container image {{.Image}}"
- podman push {{.Image}}
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
diff --git a/apps/webhook/.dockerignore b/apps/webhook/.dockerignore
index b30fec26f..d23381b64 100644
--- a/apps/webhook/.dockerignore
+++ b/apps/webhook/.dockerignore
@@ -1,3 +1,2 @@
**
-!main.go
-!internal
+!bin
diff --git a/apps/webhook/Containerfile b/apps/webhook/Containerfile
new file mode 100644
index 000000000..449115d4b
--- /dev/null
+++ b/apps/webhook/Containerfile
@@ -0,0 +1,5 @@
+#syntax=docker/dockerfile:1
+FROM gcr.io/distroless/static-debian11:nonroot
+ARG BINARY
+COPY --chown=1001 ./bin/$BINARY ./webhook
+ENTRYPOINT ["./webhook"]
diff --git a/apps/webhook/Dockerfile b/apps/webhook/Dockerfile
deleted file mode 100644
index 8d38cb2a4..000000000
--- a/apps/webhook/Dockerfile
+++ /dev/null
@@ -1,22 +0,0 @@
-# syntax=docker/dockerfile:1.4
-FROM golang:1.18.3-alpine3.16 AS base
-USER 1001
-ENV GOPATH=/tmp/go
-ENV GOCACHE=/tmp/go-cache
-WORKDIR /tmp/app
-COPY --chown=1001 --from=project-root ./go.mod ./go.sum ./tools.go ./
-RUN go mod download -x
-COPY --chown=1001 --from=project-root common ./common
-COPY --chown=1001 --from=project-root grpc-interfaces ./grpc-interfaces
-COPY --chown=1001 --from=project-root pkg ./pkg
-ARG APP
-RUN mkdir -p ./apps/$APP
-WORKDIR /tmp/app/apps/$APP
-COPY --chown=1001 ./ ./
-RUN CGO_ENABLED=0 go build -tags musl -o /tmp/bin/$APP ./main.go
-RUN chmod +x /tmp/bin/$APP
-
-FROM gcr.io/distroless/static-debian11
-ARG APP
-COPY --from=base --chown=1001 /tmp/bin/$APP /webhook
-CMD ["/webhook"]
diff --git a/apps/webhook/Taskfile.yml b/apps/webhook/Taskfile.yml
index 708068697..38c46d5f9 100644
--- a/apps/webhook/Taskfile.yml
+++ b/apps/webhook/Taskfile.yml
@@ -1,83 +1,31 @@
version: "3"
-dotenv:
- - .secrets/env
-
vars:
- ImagePrefix: "ghcr.io/kloudlite/platform/apis"
+ app: webhook
+
+includes:
+ go: ../../.tools/taskfiles/go-build.yml
tasks:
- gql:
- dir: ./internal/app
+ run:
+ dotenv:
+ - .secrets/env
cmds:
- - go run -tags dynamic github.com/99designs/gqlgen generate
- # - rm "./graph/scalars.resolvers.go"
+ - task: build
+ # - dlv exec -l 127.0.0.1:31117 --headless /tmp/webhook -- --dev
+ - ./bin/{{.app}} --dev
build:
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
- cmds:
- - go build -ldflags="-s -w" -o {{.Out}}
- - upx {{.Out}}
-
- docker-build:
- vars:
- APP: webhook
- IMAGE: registry.kloudlite.io/kloudlite/{{.EnvName}}/{{.APP}}-api:{{.Tag}}
- preconditions:
- - sh: '[[ -n "{{.Tag}}" ]]'
- msg: 'var Tag must have a value'
-
- - sh: '[[ "{{.EnvName}}" == "development" ]] || [[ "{{.EnvName}}" == "staging" ]] || [[ "{{.EnvName}}" == "production" ]]'
- msg: 'var EnvName must have one of [development, staging, production] as its value'
cmds:
- - docker buildx build -f ./Dockerfile -t {{.IMAGE}} . --build-arg APP={{.APP}} --platform linux/amd64 --build-context project-root=../..
- - docker push {{.IMAGE}}
-
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
- local-build:
+ container:build-and-push:
preconditions:
- - sh: '[ -n "{{.Tag}}" ]'
- msg: 'var Tag must have a value'
- vars:
- APP: webhook
- IMAGE: "{{.ImagePrefix}}/{{.APP}}:{{.Tag}}"
- silent: true
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
cmds:
- - |+
- lineNumbers=$(cat Dockerfile | grep -i '^FROM' -n | tail +2 | awk -F: '{print $1}')
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
- startLineNo=$(echo "$lineNumbers" | head -n+1)
- finalLineNo=$(echo "$lineNumbers" | tail -1)
-
- tDir=$(mktemp -d)
-
- nDockerfile=$(cat Dockerfile | tail --lines=+$startLineNo | grep -i --invert-match 'from=base')
- echo "$nDockerfile" | sed "1 i # syntax=docker/dockerfile:1.4" > $tDir/Dockerfile.base
-
- cat $tDir/Dockerfile.base | sed "4 i COPY --from=local-builder ./{{.APP}} /{{.APP}}" > $tDir/Dockerfile
- cat $tDir/Dockerfile
- echo "building application ..."
-
- task build Out=$tDir/{{.APP}}
-
- docker buildx build -f $tDir/Dockerfile -t {{.IMAGE}} . --build-context local-builder=${tDir}
- docker push {{.IMAGE}}
- rm -rf $tDir
-
- run:
- vars:
- Name: webhook
- dotenv:
- - .secrets/env
- env:
- CGO_ENABLED: 0
- cmds:
- - go build -o /tmp/{{.Name}} ./main.go
- # - dlv exec -l 127.0.0.1:31117 --headless /tmp/webhook -- --dev
- - /tmp/{{.Name}} --dev
diff --git a/apps/websocket-server/.dockerignore b/apps/websocket-server/.dockerignore
new file mode 100644
index 000000000..d23381b64
--- /dev/null
+++ b/apps/websocket-server/.dockerignore
@@ -0,0 +1,2 @@
+**
+!bin
diff --git a/apps/websocket-server/Containerfile b/apps/websocket-server/Containerfile
new file mode 100644
index 000000000..238f6688d
--- /dev/null
+++ b/apps/websocket-server/Containerfile
@@ -0,0 +1,5 @@
+# syntax=docker/dockerfile:1.4
+FROM gcr.io/distroless/static:nonroot
+ARG BINARY
+COPY ./bin/$BINARY ./websocket-server
+ENTRYPOINT [ "./websocket-server" ]
diff --git a/apps/websocket-server/Containerfile.local b/apps/websocket-server/Containerfile.local
deleted file mode 100644
index 07e5e5250..000000000
--- a/apps/websocket-server/Containerfile.local
+++ /dev/null
@@ -1,7 +0,0 @@
-# syntax=docker/dockerfile:1.4
-FROM gcr.io/distroless/static:nonroot
-WORKDIR /tmp
-USER 1001:1001
-ARG APP
-COPY --from=builder $APP ./websocket-server
-CMD ["./websocket-server"]
diff --git a/apps/websocket-server/Taskfile.yml b/apps/websocket-server/Taskfile.yml
index 5fe7a3b0b..2ecdbd9b0 100644
--- a/apps/websocket-server/Taskfile.yml
+++ b/apps/websocket-server/Taskfile.yml
@@ -1,61 +1,29 @@
version: "3"
-dotenv:
- - .secrets/env
-
vars:
- ImagePrefix: "ghcr.io/kloudlite/api"
+ app: websocket-server
-tasks:
- build:
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- vars:
- BuiltAt:
- sh: date | sed 's/\s/_/g'
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
- cmds:
- - go build -ldflags="-s -w -X kloudlite.io/common.BuiltAt=\"{{.BuiltAt}}\"" -o {{.Out}}
- - upx {{.Out}}
+includes:
+ go: ../../.tools/taskfiles/go-build.yml
+tasks:
run:
dotenv:
- .secrets/env
cmds:
- go run main.go --dev
- docker-build:
- vars:
- APP: finance
- IMAGE: registry.kloudlite.io/kloudlite/{{.EnvName}}/{{.APP}}-api:{{.Tag}}
- preconditions:
- - sh: '[[ -n "{{.Tag}}" ]]'
- msg: 'var Tag must have a value'
-
- - sh: '[[ "{{.EnvName}}" == "development" ]] || [[ "{{.EnvName}}" == "staging" ]] || [[ "{{.EnvName}}" == "production" ]]'
- msg: 'var EnvName must have one of [development, staging, production] as its value'
+ build:
cmds:
- - docker buildx build -f ./Dockerfile -t {{.IMAGE}} . --build-arg APP={{.APP}} --platform linux/amd64 --build-context project-root=../..
- - docker push {{.IMAGE}}
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
- local-build:
+ container:build-and-push:
preconditions:
- - sh: '[ -n "{{.Tag}}" ]'
- msg: 'var Tag must have a value'
- vars:
- Dockerfile: "./Containerfile.local"
- APP: websocket-server
- Image: "{{.ImagePrefix}}/{{.APP}}:{{.Tag}}"
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
cmds:
- - |+
- dir=$(mktemp -d)
- task build Out=$dir/{{.APP}}
-
- podman buildx build -t {{.Image}} -f {{.Dockerfile}} . --build-context builder=$dir --build-arg APP={{.APP}}
- podman push {{.Image}}
- rm -rf $dir
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
diff --git a/apps/worker-audit-logging/Containerfile b/apps/worker-audit-logging/Containerfile
new file mode 100644
index 000000000..75e4a3737
--- /dev/null
+++ b/apps/worker-audit-logging/Containerfile
@@ -0,0 +1,5 @@
+# syntax=docker/dockerfile:1.4
+FROM gcr.io/distroless/static-debian11:nonroot
+ARG BINARY
+COPY ./bin/$BINARY ./worker-audit-logging
+ENTRYPOINT [ "./worker-audit-logging" ]
diff --git a/apps/worker-audit-logging/Dockerfile b/apps/worker-audit-logging/Dockerfile
deleted file mode 100644
index b26e97835..000000000
--- a/apps/worker-audit-logging/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-# syntax=docker/dockerfile:1.4
-FROM golang:1.19.4-alpine3.16 AS base
-USER 1001
-ENV GOPATH=/tmp/go
-ENV GOCACHE=/tmp/go-cache
-WORKDIR /tmp/app
-COPY --chown=1001 --from=project-root ./go.mod ./go.sum ./tools.go ./
-RUN go mod download -x
-COPY --chown=1001 --from=project-root common ./common
-COPY --chown=1001 --from=project-root grpc-interfaces ./grpc-interfaces
-COPY --chown=1001 --from=project-root pkg ./pkg
-ARG APP
-RUN mkdir -p ./apps/$APP
-WORKDIR /tmp/app/apps/$APP
-COPY --chown=1001 ./ ./
-RUN CGO_ENABLED=0 go build -tags musl -o /tmp/bin/$APP ./main.go
-RUN chmod +x /tmp/bin/$APP
-
-FROM gcr.io/distroless/static-debian11
-USER 1001
-ARG APP
-COPY --from=base --chown=1001 /tmp/bin/$APP ./worker-audit-logging
-CMD ["./worker-audit-logging"]
diff --git a/apps/worker-audit-logging/Taskfile.yml b/apps/worker-audit-logging/Taskfile.yml
index fd84e5391..d159bc602 100644
--- a/apps/worker-audit-logging/Taskfile.yml
+++ b/apps/worker-audit-logging/Taskfile.yml
@@ -1,49 +1,22 @@
version: 3
+vars:
+ app: worker-audit-logging
+
+includes:
+ go: ../../.tools/taskfiles/go-build.yml
+
tasks:
build:
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- preconditions:
- - sh: '[ -n "{{.Out}}" ]'
- msg: var Out must have a value
cmds:
- - go build -ldflags="-s -w" -o {{.Out}}
- - upx {{.Out}}
+ - task: go:build
+ vars:
+ Out: ./bin/{{.app}}
- local-build:
+ container:build-and-push:
preconditions:
- - sh: '[ -n "{{.EnvName}}" ]'
- msg: 'var EnvName must have a value'
- - sh: '[ -n "{{.Tag}}" ]'
- msg: 'var Tag must have a value'
- vars:
- APP: worker-audit-logging
- IMAGE: registry.kloudlite.io/kloudlite/{{.EnvName}}/{{.APP}}:{{.Tag}}
- env:
- CGO_ENABLED: 0
- GOOS: linux
- GOARCH: amd64
- silent: true
+ - sh: '[[ -n "{{.Image}}" ]]'
+ msg: "var Image must have a value, of format 'image_repository:image_tag'"
cmds:
- - |+
- lineNumbers=$(cat Dockerfile | grep -i '^FROM' -n | tail +2 | awk -F: '{print $1}')
-
- startLineNo=$(echo "$lineNumbers" | head -n+1)
- finalLineNo=$(echo "$lineNumbers" | tail -1)
-
- tDir=$(mktemp -d)
-
- nDockerfile=$(cat Dockerfile | tail --lines=+$startLineNo | grep -i --invert-match 'from=base')
- echo "$nDockerfile" | sed "1 i # syntax=docker/dockerfile:1.4" > $tDir/Dockerfile.base
-
- CGO_ENABLED=0 go build -o $tDir/{{.APP}} .
-
- cat $tDir/Dockerfile.base | sed "4 i COPY --from=local-builder --chown=1001 ./{{.APP}} ./{{.APP}}" > $tDir/Dockerfile
- cat $tDir/Dockerfile
-
- docker buildx build -f $tDir/Dockerfile -t {{.IMAGE}} . --build-context local-builder=${tDir}
- docker push {{.IMAGE}}
- rm -rf $tDir
+ - task: build
+ - docker buildx build -f ./Containerfile -t {{.Image}} . --build-arg BINARY={{.app}} --push
| | | | |