Skip to content

Commit

Permalink
chore(docker): attempt to fix docker env variables and unify exports (#…
Browse files Browse the repository at this point in the history
…41)

chore(docker): attempt to fix docker env variables and unify exports
  • Loading branch information
JordanSussman authored Sep 5, 2018
1 parent 4d3aa39 commit 246a6a6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 27 deletions.
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM golang:1.11-alpine AS build
ARG VERSION=0.0.0
ARG GIT_HASH=c0ff33
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
COPY / .
RUN dep ensure
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-X github.com/target/flottbot/version.Version=${VERSION} -X github.com/target/flottbot/version.GitHash=${GIT_HASH}" \
go build -ldflags "-X github.com/target/flottbot/version.Version=${SOURCE_BRANCH} -X github.com/target/flottbot/version.GitHash=${SOURCE_COMMIT}" \
-o flottbot .

FROM alpine:3.8
RUN apk --no-cache add ca-certificates
RUN mkdir config
COPY --from=build /go/src/github.com/target/flottbot/flottbot .
EXPOSE 8080 80
EXPOSE 8080 3000 4000
10 changes: 4 additions & 6 deletions docker/Dockerfile.golang
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
FROM golang:1.11-alpine AS build
ARG VERSION=0.0.0
ARG GIT_HASH=c0ff33
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
COPY / .
RUN dep ensure
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-X github.com/target/flottbot/version.Version=${VERSION} -X github.com/target/flottbot/version.GitHash=${GIT_HASH}" \
go build -ldflags "-X github.com/target/flottbot/version.Version=${SOURCE_BRANCH} -X github.com/target/flottbot/version.GitHash=${SOURCE_COMMIT}" \
-o flottbot .

FROM golang:1.11-alpine
RUN apk add --no-cache git
RUN mkdir config
COPY --from=build /go/src/github.com/target/flottbot/flottbot .
EXPOSE 8080 80
EXPOSE 3000 3000
EXPOSE 4000 4000
EXPOSE 8080 3000 4000
8 changes: 4 additions & 4 deletions docker/Dockerfile.ruby
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM golang:1.11-alpine AS build
ARG VERSION=0.0.0
ARG GIT_HASH=c0ff33
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
COPY / .
RUN dep ensure
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -ldflags "-X github.com/target/flottbot/version.Version=${VERSION} -X github.com/target/flottbot/version.GitHash=${GIT_HASH}" \
go build -ldflags "-X github.com/target/flottbot/version.Version=${SOURCE_BRANCH} -X github.com/target/flottbot/version.GitHash=${SOURCE_COMMIT}" \
-o flottbot .

FROM ruby:2.5-alpine
RUN apk add --no-cache ruby-dev build-base
RUN mkdir config
COPY --from=build /go/src/github.com/target/flottbot/flottbot .
EXPOSE 8080 80
EXPOSE 8080 3000 4000
8 changes: 8 additions & 0 deletions docker/hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash -xe
DOCKER_PATH=$(echo $DOCKERFILE_PATH | sed -e 's/.*\///g')

docker build \
--build-arg "SOURCE_BRANCH=$SOURCE_BRANCH" \
--build-arg "SOURCE_COMMIT=$SOURCE_COMMIT" \
-f $DOCKER_PATH \
-t $IMAGE_NAME ../
7 changes: 0 additions & 7 deletions hooks/build

This file was deleted.

6 changes: 0 additions & 6 deletions hooks/env

This file was deleted.

0 comments on commit 246a6a6

Please sign in to comment.