Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
Use vendored dependencies instead of mounting GOPATH directory.
Browse files Browse the repository at this point in the history
This is a little less confusing and improves IDE support.

This required changing to a non-Alpine-based image for the build env due
to golang/go#28065, and therefore building a
statically-linked binary for the production image.
  • Loading branch information
charleskorn committed Mar 16, 2019
1 parent 9fad8c2 commit 61f3aa3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*.out

batect-sample-golang
.go-cache/
vendor/

# JetBrains (IntelliJ etc.)
.idea/
Expand Down
12 changes: 7 additions & 5 deletions batect.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
containers:
build-env:
build_directory: dev-infrastructure/build-env
image: golang:1.12.1-stretch
volumes:
- local: .
container: /code
options: cached
- local: .go-cache
container: /go
options: delegated
environment:
GOFLAGS: -mod=vendor
working_directory: /code
run_as_current_user:
enabled: true
Expand All @@ -22,14 +21,17 @@ tasks:
group: Setup tasks
run:
container: build-env
command: go mod download
command: go mod vendor

build:
description: Build the application.
group: Build tasks
run:
container: build-env
command: go build -o dev-infrastructure/app/batect-sample-golang .
environment:
CGO_ENABLED: 0
GOOS: linux

unitTest:
description: Run the unit tests.
Expand Down
5 changes: 0 additions & 5 deletions dev-infrastructure/build-env/Dockerfile

This file was deleted.

0 comments on commit 61f3aa3

Please sign in to comment.