Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated docker files to use go modules #105

Merged
merged 4 commits into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
updated docker files to use go modules
  • Loading branch information
Mark Sargent committed May 31, 2019
commit e56c0ec187b41113d52749b6f62d15339a9650e4
27 changes: 26 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
SOURCE_COMMIT := $(shell git log -1 --pretty=format:"%H")
SOURCE_BRANCH := $(shell git branch | grep \* | cut -d ' ' -f2)
TAG := target/flottbot

.PHONY: all docker

build:
go build -v -a -o flottbot cmd/flottbot/main.go

run: build
./flottbot
./flottbot

docker:
docker build \
--build-arg "SOURCE_BRANCH=$(SOURCE_BRANCH)" \
--build-arg "SOURCE_COMMIT=$(SOURCE_COMMIT)" \
-f "./docker/Dockerfile.ruby" \
-t $(TAG):ruby .

docker build \
--build-arg "SOURCE_BRANCH=$(SOURCE_BRANCH)" \
--build-arg "SOURCE_COMMIT=$(SOURCE_COMMIT)" \
-f "./docker/Dockerfile.python" \
-t $(TAG):python .

docker build \
--build-arg "SOURCE_BRANCH=$(SOURCE_BRANCH)" \
--build-arg "SOURCE_COMMIT=$(SOURCE_COMMIT)" \
-f "./docker/Dockerfile.golang" \
-t $(TAG):golang .
8 changes: 4 additions & 4 deletions docker/Dockerfile.golang
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM golang:1.11-alpine AS build
FROM golang:1.12-alpine AS build
ARG SOURCE_BRANCH
ARG SOURCE_COMMIT
WORKDIR /go/src/github.com/target/flottbot/
RUN apk add --no-cache git
RUN go get -u github.com/golang/dep/cmd/dep
ENV GO111MODULE=on
COPY / .
RUN dep ensure
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-X github.com/target/flottbot/version.Version=${SOURCE_BRANCH} -X github.com/target/flottbot/version.GitHash=${SOURCE_COMMIT}" \
-o flottbot ./cmd/flottbot

FROM golang:1.11-alpine
FROM golang:1.12-alpine
RUN apk add --no-cache git && mkdir config
COPY --from=build /go/src/github.com/target/flottbot/flottbot .
EXPOSE 8080 3000 4000
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile.python
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM golang:1.11-alpine AS build
FROM golang:1.12-alpine AS build
ARG SOURCE_BRANCH
ARG SOURCE_COMMIT
WORKDIR /go/src/github.com/target/flottbot/
RUN apk add --no-cache git
RUN go get -u github.com/golang/dep/cmd/dep
ENV GO111MODULE=on
COPY / .
RUN dep ensure
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-X github.com/target/flottbot/version.Version=${SOURCE_BRANCH} -X github.com/target/flottbot/version.GitHash=${SOURCE_COMMIT}" \
-o flottbot ./cmd/flottbot
Expand Down
6 changes: 3 additions & 3 deletions docker/Dockerfile.ruby
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM golang:1.11-alpine AS build
FROM golang:1.12-alpine AS build
ARG SOURCE_BRANCH
ARG SOURCE_COMMIT
WORKDIR /go/src/github.com/target/flottbot/
RUN apk add --no-cache git
RUN go get -u github.com/golang/dep/cmd/dep
ENV GO111MODULE=on
COPY / .
RUN dep ensure
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-X github.com/target/flottbot/version.Version=${SOURCE_BRANCH} -X github.com/target/flottbot/version.GitHash=${SOURCE_COMMIT}" \
-o flottbot ./cmd/flottbot
Expand Down