mirror of https://github.com/status-im/migrate.git
add dockerization Fix #23
Signed-off-by: Alexandre MARRE <me@itsalex.fr>
This commit is contained in:
parent
81e9fff605
commit
fb7bb4f87a
|
@ -0,0 +1,13 @@
|
|||
# Project
|
||||
FAQ.md
|
||||
README.md
|
||||
LICENSE
|
||||
Makefile
|
||||
.gitignore
|
||||
.travis.yml
|
||||
CONTRIBUTING.md
|
||||
MIGRATIONS.md
|
||||
docker-deploy.sh
|
||||
|
||||
# Golang
|
||||
testing
|
|
@ -68,3 +68,9 @@ deploy:
|
|||
go: "1.10"
|
||||
repo: golang-migrate/migrate
|
||||
tags: true
|
||||
- provider: script
|
||||
script: ./docker-deploy.sh
|
||||
on:
|
||||
go: "1.10"
|
||||
repo: golang-migrate/migrate
|
||||
tags: true
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
FROM golang:1.10-alpine3.7 AS downloader
|
||||
|
||||
RUN apk add --no-cache git gcc musl-dev
|
||||
|
||||
WORKDIR /go/src/github.com/golang-migrate/migrate
|
||||
|
||||
COPY *.go ./
|
||||
COPY cli ./cli
|
||||
COPY database ./database
|
||||
COPY source ./source
|
||||
|
||||
RUN go get -v ./... && \
|
||||
go get -u github.com/fsouza/fake-gcs-server/fakestorage && \
|
||||
go get -u github.com/kshvakov/clickhouse && \
|
||||
GOOS=linux GOARCH=386 go build -a -o build/migrate.linux-386 -ldflags='-X main.Version=$(VERSION)' -tags '$(DATABASE) $(SOURCE)' ./cli
|
||||
|
||||
FROM alpine:3.7
|
||||
|
||||
RUN apk add --no-cache ca-certificates
|
||||
|
||||
COPY --from=downloader /go/src/github.com/golang-migrate/migrate/build/migrate.linux-386 /migrate
|
||||
RUN chmod u+x /migrate
|
||||
|
||||
ENTRYPOINT ["/migrate"]
|
||||
CMD ["--help"]
|
|
@ -65,6 +65,12 @@ $ brew install migrate --with-postgres
|
|||
$ migrate -database postgres://localhost:5432/database up 2
|
||||
```
|
||||
|
||||
### Docker usage
|
||||
|
||||
```
|
||||
$ docker run -v {{ migration dir }}:/migrations --network host migrate/migrate
|
||||
-path=/migrations/ -database postgres://localhost:5432/database up 2
|
||||
```
|
||||
|
||||
## Use in your Go project
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin && \
|
||||
docker build . -t migrate/migrate:"$TRAVIS_TAG" && \
|
||||
docker push migrate/migrate:"$TRAVIS_TAG"
|
Loading…
Reference in New Issue