Browse Source

chore: update instructions and Dockerbuild to work with modules

pull/86/head
Jacob McCann 6 years ago
parent
commit
a22d272a0b
No known key found for this signature in database GPG Key ID: B5A476DE32B9AE72
  1. 1
      .dockerignore
  2. 16
      Dockerfile
  3. 13
      README.md

1
.dockerignore

@ -0,0 +1 @@
.git

16
Dockerfile

@ -1,12 +1,16 @@
# Docker image for the Drone Terraform plugin # Docker image for the Drone Terraform plugin
# #
# docker build -t jmccann/drone-terraform:latest . # docker build -t jmccann/drone-terraform:latest .
FROM golang:1.10-alpine AS builder FROM golang:1.11-alpine AS builder
COPY ./*.go ./src/
COPY ./vendor/ ./src/ RUN apk add --no-cache git
RUN set -ex \
&& cd ./src \ RUN mkdir -p /tmp/drone-terraform
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o /go/bin/drone-terraform WORKDIR /tmp/drone-terraform
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o /go/bin/drone-terraform
FROM alpine:3.7 FROM alpine:3.7

13
README.md

@ -10,8 +10,10 @@ a listing of the available options please take a look at [the docs](https://gith
Build the binary with the following commands: Build the binary with the following commands:
``` ```
go build export GO111MODULE=on
go mod download
go test go test
go build
``` ```
## Docker ## Docker
@ -19,18 +21,9 @@ go test
Build the docker image with the following commands: Build the docker image with the following commands:
``` ```
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo
docker build --rm=true -t jmccann/drone-terraform . docker build --rm=true -t jmccann/drone-terraform .
``` ```
Please note incorrectly building the image for the correct x64 linux and with
GCO disabled will result in an error when running the Docker image:
```
docker: Error response from daemon: Container command
'/bin/drone-terraform' not found or does not exist.
```
## Usage ## Usage
Execute from the working directory: Execute from the working directory:

Loading…
Cancel
Save