mirror of
https://github.com/TECHNOFAB11/dbmate.git
synced 2025-12-12 08:00:04 +01:00
parent
f150d6aeff
commit
4e01c75eca
5 changed files with 29 additions and 19 deletions
10
.travis.yml
10
.travis.yml
|
|
@ -2,13 +2,9 @@ sudo: required
|
|||
services:
|
||||
- docker
|
||||
install:
|
||||
- curl -fsSL https://github.com/docker/compose/releases/download/1.12.0/docker-compose-`uname -s`-`uname -m` > docker-compose
|
||||
- chmod +x docker-compose
|
||||
- sudo mv docker-compose /usr/local/bin/docker-compose
|
||||
- docker version
|
||||
- docker-compose version
|
||||
- docker-compose pull
|
||||
- docker-compose build
|
||||
- docker-compose up -d
|
||||
- docker-compose run dbmate go version
|
||||
script:
|
||||
- make
|
||||
- docker build -t dbmate .
|
||||
- docker run --rm dbmate --help
|
||||
|
|
|
|||
10
Dockerfile
10
Dockerfile
|
|
@ -1,4 +1,5 @@
|
|||
FROM golang:1.9
|
||||
# build image
|
||||
FROM golang:1.9 as build
|
||||
|
||||
# required to force cgo (for sqlite driver) with cross compile
|
||||
ENV CGO_ENABLED 1
|
||||
|
|
@ -13,6 +14,9 @@ COPY . $GOPATH/src/github.com/amacneil/dbmate
|
|||
WORKDIR $GOPATH/src/github.com/amacneil/dbmate
|
||||
|
||||
# build
|
||||
RUN go install -v ./cmd/dbmate
|
||||
RUN go build -ldflags '-s' -o /go/bin/dbmate ./cmd/dbmate
|
||||
|
||||
CMD dbmate
|
||||
# runtime image
|
||||
FROM debian:stretch-slim
|
||||
COPY --from=build /go/bin/dbmate /usr/local/bin/dbmate
|
||||
ENTRYPOINT ["dbmate"]
|
||||
|
|
|
|||
12
Makefile
12
Makefile
|
|
@ -13,14 +13,14 @@ container:
|
|||
$(DC) up -d
|
||||
|
||||
lint:
|
||||
$(DC) run dbmate golint -set_exit_status $(PACKAGES)
|
||||
$(DC) run dbmate go vet $(PACKAGES)
|
||||
$(DC) run dbmate errcheck $(PACKAGES)
|
||||
$(DC) run --rm dbmate golint -set_exit_status $(PACKAGES)
|
||||
$(DC) run --rm dbmate go vet $(PACKAGES)
|
||||
$(DC) run --rm dbmate errcheck $(PACKAGES)
|
||||
|
||||
test:
|
||||
$(DC) run dbmate go test -v $(PACKAGES)
|
||||
$(DC) run --rm dbmate go test -v $(PACKAGES)
|
||||
|
||||
build: clean
|
||||
$(DC) run -e GOARCH=amd64 dbmate go build $(BUILD_FLAGS) -o dist/dbmate-linux-amd64 ./cmd/dbmate
|
||||
$(DC) run --rm -e GOARCH=amd64 dbmate go build $(BUILD_FLAGS) -o dist/dbmate-linux-amd64 ./cmd/dbmate
|
||||
# musl target does not support sqlite
|
||||
$(DC) run -e GOARCH=amd64 -e CGO_ENABLED=0 dbmate go build $(BUILD_FLAGS) -o dist/dbmate-linux-musl-amd64 ./cmd/dbmate
|
||||
$(DC) run --rm -e GOARCH=amd64 -e CGO_ENABLED=0 dbmate go build $(BUILD_FLAGS) -o dist/dbmate-linux-musl-amd64 ./cmd/dbmate
|
||||
|
|
|
|||
10
README.md
10
README.md
|
|
@ -42,6 +42,14 @@ $ sudo curl -fsSL -o /usr/local/bin/dbmate https://github.com/amacneil/dbmate/re
|
|||
$ sudo chmod +x /usr/local/bin/dbmate
|
||||
```
|
||||
|
||||
**Docker**
|
||||
|
||||
You can run dbmate using the official docker image:
|
||||
|
||||
```sh
|
||||
$ docker run --rm amacneil/dbmate --help
|
||||
```
|
||||
|
||||
**Heroku**
|
||||
|
||||
To use dbmate on Heroku, the easiest method is to store the linux binary in your git repository:
|
||||
|
|
@ -55,7 +63,7 @@ $ git commit -m "Add dbmate binary"
|
|||
$ git push heroku master
|
||||
```
|
||||
|
||||
You can now run dbmate on heroku:
|
||||
You can then run dbmate on heroku:
|
||||
|
||||
```sh
|
||||
$ heroku run bin/dbmate-heroku up
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
version: '2.1'
|
||||
version: '2.3'
|
||||
services:
|
||||
dbmate:
|
||||
build: .
|
||||
build:
|
||||
context: .
|
||||
target: build
|
||||
volumes:
|
||||
- .:/go/src/github.com/amacneil/dbmate
|
||||
depends_on:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue