mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-12 16:10:03 +01:00
* Go v1.11 * [Go Modules](https://github.com/golang/go/wiki/Modules) * [GolangCI-Lint](https://github.com/golangci/golangci-lint) * [Distroless](https://github.com/GoogleContainerTools/distroless) docker image
34 lines
604 B
Makefile
34 lines
604 B
Makefile
DC := docker-compose
|
|
BUILD_FLAGS := -ldflags '-s'
|
|
|
|
.PHONY: all
|
|
all: test lint build
|
|
|
|
.PHONY: test
|
|
test:
|
|
go test -v ./...
|
|
|
|
.PHONY: lint
|
|
lint:
|
|
golangci-lint run
|
|
|
|
.PHONY: wait
|
|
wait:
|
|
dist/dbmate-linux-amd64 -e MYSQL_URL wait
|
|
dist/dbmate-linux-amd64 -e POSTGRESQL_URL wait
|
|
|
|
.PHONY: clean
|
|
clean:
|
|
rm -rf dist
|
|
|
|
.PHONY: build
|
|
build: clean
|
|
GOARCH=amd64 go build $(BUILD_FLAGS) -o dist/dbmate-linux-amd64 .
|
|
# musl target does not support sqlite
|
|
GOARCH=amd64 CGO_ENABLED=0 go build $(BUILD_FLAGS) -o dist/dbmate-linux-musl-amd64 .
|
|
|
|
.PHONY: docker
|
|
docker:
|
|
$(DC) pull
|
|
$(DC) build
|
|
$(DC) run --rm dbmate make
|