0
0
mirror of https://github.com/thegeeklab/wp-opentofu.git synced 2024-11-22 00:30:40 +00:00

chore: update instructions and Dockerbuild to work with modules

This commit is contained in:
Jacob McCann 2019-02-22 08:40:57 -06:00
parent b9bfc74bcc
commit a22d272a0b
No known key found for this signature in database
GPG Key ID: B5A476DE32B9AE72
3 changed files with 14 additions and 16 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
.git

View File

@ -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

View File

@ -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: