Browse Source
chore: update instructions and Dockerbuild to work with modules
pull/86/head
Jacob McCann
6 years ago
No known key found for this signature in database
GPG Key ID: B5A476DE32B9AE72
3 changed files with
14 additions and
16 deletions
-
.dockerignore
-
Dockerfile
-
README.md
|
|
@ -1,12 +1,16 @@ |
|
|
|
# Docker image for the Drone Terraform plugin |
|
|
|
# |
|
|
|
# docker build -t jmccann/drone-terraform:latest . |
|
|
|
FROM golang:1.10-alpine AS builder |
|
|
|
COPY ./*.go ./src/ |
|
|
|
COPY ./vendor/ ./src/ |
|
|
|
RUN set -ex \ |
|
|
|
&& cd ./src \ |
|
|
|
&& CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o /go/bin/drone-terraform |
|
|
|
FROM golang:1.11-alpine AS builder |
|
|
|
|
|
|
|
RUN apk add --no-cache git |
|
|
|
|
|
|
|
RUN mkdir -p /tmp/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 |
|
|
|
|
|
|
|
|
|
@ -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: |
|
|
|
|
|
|
|
``` |
|
|
|
go build |
|
|
|
export GO111MODULE=on |
|
|
|
go mod download |
|
|
|
go test |
|
|
|
go build |
|
|
|
``` |
|
|
|
|
|
|
|
## Docker |
|
|
@ -19,18 +21,9 @@ go test |
|
|
|
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 . |
|
|
|
``` |
|
|
|
|
|
|
|
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 |
|
|
|
|
|
|
|
Execute from the working directory: |
|
|
|