Skip to content

Commit 49f67a8

Browse files
committed
Use make for docker builds so all releases use the same db and source drivers
1 parent 23608f1 commit 49f67a8

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

.dockerignore

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
FAQ.md
33
README.md
44
LICENSE
5-
Makefile
65
.gitignore
76
.travis.yml
87
CONTRIBUTING.md

Dockerfile

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
FROM golang:1.14-alpine3.12 AS builder
22
ARG VERSION
33

4-
RUN apk add --no-cache git gcc musl-dev
4+
RUN apk add --no-cache git gcc musl-dev make
55

66
WORKDIR /go/src/github.com/golang-migrate/migrate
77

88
ENV GO111MODULE=on
9-
ENV DATABASES="postgres mysql redshift cassandra spanner cockroachdb clickhouse mongodb sqlserver firebird sqlite3 neo4j"
10-
ENV SOURCES="file go_bindata github github_ee aws_s3 google_cloud_storage godoc_vfs gitlab"
119

1210
COPY go.mod go.sum ./
1311

1412
RUN go mod download
1513

1614
COPY . ./
1715

18-
RUN go build -a -o build/migrate.linux-386 -ldflags="-s -w -X main.Version=${VERSION}" -tags "$DATABASES $SOURCES" ./cmd/migrate
16+
RUN make build-docker
1917

2018
FROM alpine:3.12
2119

Makefile

+5-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ COVERAGE_DIR ?= .coverage
99
build:
1010
CGO_ENABLED=0 go build -ldflags='-X main.Version=$(VERSION)' -tags '$(DATABASE) $(SOURCE)' ./cmd/migrate
1111

12+
build-docker:
13+
CGO_ENABLED=0 go build -a -o build/migrate.linux-386 -ldflags="-s -w -X main.Version=${VERSION}" -tags "$(DATABASE) $(SOURCE)" ./cmd/migrate
14+
1215
build-cli: clean
1316
-mkdir ./cli/build
1417
cd ./cmd/migrate && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o ../../cli/build/migrate.linux-amd64 -ldflags='-X main.Version=$(VERSION) -extldflags "-static"' -tags '$(DATABASE) $(SOURCE)' .
@@ -102,10 +105,10 @@ define external_deps
102105
endef
103106

104107

105-
.PHONY: build build-cli clean test-short test test-with-flags html-coverage \
108+
.PHONY: build build-docker build-cli clean test-short test test-with-flags html-coverage \
106109
restore-import-paths rewrite-import-paths list-external-deps release \
107110
docs kill-docs open-docs kill-orphaned-docker-containers
108111

109-
SHELL = /bin/bash
112+
SHELL = /bin/sh
110113
RAND = $(shell echo $$RANDOM)
111114

0 commit comments

Comments
 (0)