Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build-docker and test-docker target to build without local Golang #1472

Merged

Conversation

StefanScherer
Copy link
Contributor

This may be helpful for community to get started compiling the plugin and start sending pull requests without the need to setup Golang on the local machine.

My Golang setup on my MacBook is quite old, I tried several first beginners steps and I just didn't want to touch it right now. I wanted to send a PR for #1471 and compile and test the plugin for my MacBook.

These two additional make targets allow users to build and test the plugin within a Linux Docker container with eg. Docker4Mac (and probably Docker4Windows).

Compiling the Linux version of the plugin:

$ make build-docker
mkdir -p bin
docker run --rm -v $(pwd)/bin:/go/bin -v $(pwd):/go/src/github.com/terraform-providers/terraform-provider-azurerm -w /go/src/github.com/terraform-providers/terraform-provider-azurerm -e GOOS golang:1.10 make build
==> Checking that code complies with gofmt requirements...
go install

$ ls bin
terraform-provider-azurerm

Compiling the macOS version of the plugin:

$ GOOS=darwin make build-docker
mkdir -p bin
docker run --rm -v $(pwd)/bin:/go/bin -v $(pwd):/go/src/github.com/terraform-providers/terraform-provider-azurerm -w /go/src/github.com/terraform-providers/terraform-provider-azurerm -e GOOS golang:1.10 make build
==> Checking that code complies with gofmt requirements...
go install

$ ls bin/darwin_amd64/
terraform-provider-azurerm

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks for this 👍

@tombuildsstuff tombuildsstuff merged commit 5bc3b84 into hashicorp:master Jul 2, 2018
@StefanScherer StefanScherer deleted the build-and-test-in-docker branch July 2, 2018 13:34
@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants