Skip to content

Commit

Permalink
Move to using go.mod
Browse files Browse the repository at this point in the history
  • Loading branch information
Levi committed Sep 18, 2019
1 parent fde4254 commit 8de965a
Show file tree
Hide file tree
Showing 4 changed files with 124 additions and 27 deletions.
30 changes: 16 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ version: 2
jobs:
test:
docker:
# specify the version
- image: circleci/golang:1.13
environment:
GO111MODULE: "on"
PGUSER: circleci
PGDATABASE: circleci
PGPASSWORD: circleci
Expand All @@ -17,10 +17,14 @@ jobs:
POSTGRES_PASSWORD: circleci
POSTGRES_USER: circleci
POSTGRES_DB: circleci
working_directory: /go/src/github.com/smithoss/gonymizer
working_directory: /tmp/gonymizer
steps:
- checkout
- run: go get -v -t -d ./...
- run:
name: Go Mod
command: |
go mod vendor
go mod download
- run:
name: Install PSQL client
command: sudo apt install -y postgresql-client curl || true
Expand Down Expand Up @@ -54,21 +58,19 @@ jobs:
fi
deploy:
build:
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
docker:
- image: circleci/golang:1.13
environment:
GO111MODULE: "on"
working_directory: /tmp/gonymizer
steps:
- checkout
- setup_remote_docker
- run:
name: Go get
command: go get -v -t -d ./...
- run:
name: Go mod install
name: Go Mod
command: |
go version
go mod tidy
go mod vendor
go mod vendor
go mod download
- run:
name: Docker Login
command: docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PASS
Expand Down
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@
FROM golang:1.13-alpine as build
ENV GO111MODULE=on
RUN apk update && apk upgrade && apk add --no-cache bash git gcc go linux-headers musl-dev postgresql curl
RUN mkdir -p /usr/local/go/src/github.com/smithoss/gonymizer/
WORKDIR /usr/local/go/src/github.com/smithoss/gonymizer/
COPY . /usr/local/go/src/github.com/smithoss/gonymizer/
RUN mkdir -p /tmp/gonymizer/
RUN mkdir -p /tmp/gonymizer/bin
WORKDIR /tmp/gonymizer/
COPY go.mod .
COPY go.sum .
RUN go mod download
WORKDIR /usr/local/go/src/github.com/smithoss/gonymizer/cmd/
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -v -ldflags '-w -extldflags "-static"' -o ../gonymizer
COPY . .
RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 GOFLAGS=-mod=vendor go build -v -ldflags '-w -extldflags "-static"' -o bin/gonymizer ./cmd/...

##########################
### Gonymizer Runtime ###
##########################
FROM golang:1.13-alpine as gonymizer
RUN apk update && apk upgrade && apk add --no-cache postgresql curl

COPY --from=build /usr/local/go/src/github.com/smithoss/gonymizer/gonymizer /usr/bin/gonymizer
COPY --from=build /tmp/gonymizer/bin/gonymizer /usr/bin/gonymizer
8 changes: 3 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,19 @@ module github.com/smithoss/gonymizer
go 1.13

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/aws/aws-sdk-go v1.19.25
github.com/aws/aws-sdk-go v1.24.0
github.com/corpix/uarand v0.1.0 // indirect
github.com/google/uuid v1.1.1
github.com/icrowley/fake v0.0.0-20180203215853-4178557ae428
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/lib/pq v1.1.1
github.com/logrusorgru/aurora v0.0.0-20190428105938-cea283e61946
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect
github.com/onsi/ginkgo v1.10.1 // indirect
github.com/onsi/gomega v1.7.0 // indirect
github.com/sirupsen/logrus v1.4.1
github.com/spf13/cobra v0.0.3
github.com/spf13/viper v1.3.2
github.com/spf13/cobra v0.0.5 // indirect
github.com/spf13/viper v1.4.0 // indirect
github.com/stretchr/testify v1.3.0
github.com/x-cray/logrus-prefixed-formatter v0.5.2
golang.org/x/crypto v0.0.0-20190506204251-e1dfcc566284
Expand Down
Loading

0 comments on commit 8de965a

Please sign in to comment.