Skip to content

Conversation

@rofc
Copy link

@rofc rofc commented Dec 15, 2020

Just in case you don't want to install Golang to build the package/binary or, just like me, you like to run apps from containers here is a very simple Dockerfile.

You will need to:

  1. Checkout the code
  2. Build the image, docker buitd -t IMAGE_NAME .
  3. Run the container, docker run --rm -ti IMAGE_NAME

@normen
Copy link
Owner

normen commented Dec 15, 2020

This looks nice, thanks. I don't have much experience with docker but can't the image build check out the compiler and source automatically and delete it afterwards? For just creating an image containing golang and whatscli it seems a bit pointless to add this?

@rofc
Copy link
Author

rofc commented Dec 16, 2020

This looks nice, thanks. I don't have much experience with docker but can't the image build check out the compiler and source automatically and delete it afterwards? For just creating an image containing golang and whatscli it seems a bit pointless to add this?

Here you have a multi-stage dockerfile. make build is executed on golang stage and then the binary is copied into alpine stage.
Steps were not modified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants