-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build dateilager within the dockerfile using the nix environment
This switches the build process to: - build DL within the dockerfile for repeatable builds, instead of copying in from outside - use the nix environment to setup the env for the build, so it's the same go version / protoc version etc etc in and outside of docker - use a multistage docker build so we have slim containers with just the binary at the end I did all this because I was fighting to get a docker image built for linux_arm64, which is what orbstack needs to run the image locally in a k8s setup! It was annoying. This also adds linux_arm64 as a build target to the makefile, and teaches the dockerfile how to build the binary for the target architecture that the dockerfile is building for. Yeesh.
- Loading branch information
Showing
8 changed files
with
81 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.git | ||
.direnv | ||
Dockerfile | ||
js | ||
test | ||
tmp | ||
bin | ||
input | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,24 +21,14 @@ PROTO_FILES := $(shell find internal/pb/ -type f -name '*.proto') | |
MIGRATE_DIR := ./migrations | ||
SERVICE := $(PROJECT).server | ||
|
||
.PHONY: install migrate migrate-create clean build lint release | ||
.PHONY: migrate migrate-create clean build lint release | ||
.PHONY: test test-one test-fuzz test-js lint-js build-js | ||
.PHONY: reset-db setup-local server server-profile install-js | ||
.PHONY: client-update client-large-update client-get client-rebuild client-rebuild-with-cache | ||
.PHONY: client-getcache client-gc-contents client-gc-project client-gc-random-projects | ||
.PHONY: health upload-container-image run-container gen-docs | ||
.PHONY: load-test-new load-test-get load-test-update | ||
|
||
install: | ||
go install google.golang.org/protobuf/cmd/[email protected] | ||
go install google.golang.org/grpc/cmd/[email protected] | ||
go install github.com/grpc-ecosystem/[email protected] | ||
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/[email protected] | ||
go install github.com/bojand/ghz/cmd/[email protected] | ||
go install github.com/gadget-inc/fsdiff/cmd/[email protected] | ||
go install github.com/stamblerre/gocode@latest | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
|
||
migrate: | ||
migrate -database $(DB_URI)?sslmode=disable -path $(MIGRATE_DIR) up | ||
|
||
|
@@ -78,9 +68,14 @@ build: internal/pb/fs.pb.go internal/pb/fs_grpc.pb.go bin/server bin/client deve | |
lint: | ||
golangci-lint run | ||
|
||
|
||
|
||
release/%_linux_amd64: cmd/%/main.go $(PKG_GO_FILES) $(INTERNAL_GO_FILES) go.sum | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build $(BUILD_FLAGS) -o $@ $< | ||
|
||
release/%_linux_arm64: cmd/%/main.go $(PKG_GO_FILES) $(INTERNAL_GO_FILES) go.sum | ||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build $(BUILD_FLAGS) -o $@ $< | ||
|
||
release/%_macos_amd64: cmd/%/main.go $(PKG_GO_FILES) $(INTERNAL_GO_FILES) go.sum | ||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build $(BUILD_FLAGS) -o $@ $< | ||
|
||
|
@@ -193,7 +188,7 @@ health: | |
grpc-health-probe -addr $(GRPC_SERVER) | ||
grpc-health-probe -addr $(GRPC_SERVER) -service $(SERVICE) | ||
|
||
upload-container-image: release | ||
upload-container-image: | ||
ifndef version | ||
$(error version variable must be set) | ||
else | ||
|
@@ -206,8 +201,10 @@ upload-prerelease-container-image: release | |
docker build -t gcr.io/gadget-core-production/dateilager:$(GIT_COMMIT) . | ||
docker push gcr.io/gadget-core-production/dateilager:$(GIT_COMMIT) | ||
|
||
run-container: release | ||
build-local-container: | ||
docker build -t dl-local:latest . | ||
|
||
run-container: release build-local-container | ||
docker run --rm -it -p 127.0.0.1:$(GRPC_PORT):$(GRPC_PORT)/tcp -v ./development:/home/main/secrets/tls -v ./development:/home/main/secrets/paseto dl-local:latest $(GRPC_PORT) "postgres://$(DB_USER):$(DB_PASS)@host.docker.internal:5432" dl | ||
|
||
gen-docs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.