Skip to content

Commit

Permalink
refactor(supervisor): move main to root
Browse files Browse the repository at this point in the history
  • Loading branch information
Darkness4 committed Sep 27, 2023
1 parent 2ea4214 commit 4358bd7
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 18 deletions.
6 changes: 3 additions & 3 deletions supervisor/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ARG TARGETOS TARGETARCH
ARG BUILDVERSION=dev
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -ldflags "-s -w -X main.version=${BUILDVERSION}" -o /out/app ./cmd
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH go build -a -ldflags "-s -w -X main.version=${BUILDVERSION}" -o /out/supervisor ./

# ---
FROM --platform=$BUILDPLATFORM registry-1.docker.io/library/alpine as certs
Expand All @@ -28,7 +28,7 @@ RUN mkdir /app
RUN addgroup -S app && adduser -S -G app app
WORKDIR /app

COPY --from=builder /out/app .
COPY --from=builder /out/supervisor .
COPY --from=certs /etc/ssl/certs /etc/ssl/certs

ADD https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/v0.4.13/grpc_health_probe-$TARGETOS-$TARGETARCH /bin/grpc_health_probe
Expand All @@ -40,4 +40,4 @@ USER app

EXPOSE 3000

ENTRYPOINT [ "/tini", "--", "./app" ]
ENTRYPOINT [ "/tini", "--", "./supervisor" ]
28 changes: 14 additions & 14 deletions supervisor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif

.PHONY: bin/supervisor
bin/supervisor: $(GO_SRCS)
go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/checksums.txt: $(addprefix bin/,$(bins))
sha256sum -b $(addprefix bin/,$(bins)) | sed 's/bin\///' > $@
Expand All @@ -30,43 +30,43 @@ bin/checksums.md: bin/checksums.txt
@echo "\`\`\`" >> $@

bin/supervisor-darwin-amd64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-darwin-arm64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-freebsd-amd64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-freebsd-arm64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-linux-amd64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-linux-arm64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-linux-mips64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-linux-mips64le: $(GO_SRCS)
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-linux-ppc64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-linux-ppc64le: $(GO_SRCS)
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=ppc64le go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-linux-riscv64: $(GO_SRCS)
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=riscv64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-linux-s390x: $(GO_SRCS)
CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=linux GOARCH=s390x go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bin/supervisor-windows-amd64.exe: $(GO_SRCS)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./cmd/main.go
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -X main.version=${VERSION}" -o "$@" ./main.go

bins := supervisor-darwin-amd64 supervisor-darwin-arm64 supervisor-freebsd-arm64 supervisor-freebsd-arm64 supervisor-linux-amd64 supervisor-linux-arm64 supervisor-linux-mips64 supervisor-linux-mips64le supervisor-linux-ppc64 supervisor-linux-ppc64le supervisor-linux-riscv64 supervisor-linux-s390x supervisor-windows-amd64.exe

Expand Down
6 changes: 5 additions & 1 deletion supervisor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,12 @@ More details [here](https://github.com/deepsquare-io/grid/pkgs/container/supervi
## Build
The `main` function is stored in the `cmd` package. To build the supervisor, do:
To build the supervisor, just do:
```shell
make
```
## License
The supervisor is [licensed under GPL3](./LICENSE).
File renamed without changes.

0 comments on commit 4358bd7

Please sign in to comment.