Skip to content

Builder image to create go applications.

License

Notifications You must be signed in to change notification settings

muhittink/builder

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Common Builder

Makefile

Use this repository in your Makefile by including it:

BINARY := metal-api
MAINMODULE := <your package>
COMMONDIR := $(or ${COMMONDIR},../../common)

include $(COMMONDIR)/Makefile.inc

release:: all ;

You have to:

  • specify the BINARY name. This will be the generated binary, it will be placed in the bin folder.
  • specify the MAINMODULE path. This path should point to the folder of your main.go
  • specify the COMMONDIR is the directory where this repository is located. you MUST evaluate if there is an environment variable COMMONDIR and use this one, so that our CI server and multistage builds can set this path to another location than on your local pc.
  • overwrite the release target (note the two colons after the target name). Normally you should set this to the all which compiles your go code. But sometimes you want to do something before compiling (generate code, etcpp.).

Now you can simply make to build a binary

Dockerfile for builder

You can use the image as a base builder image in your own Dockerfile:

FROM metalstack/builder:latest as builder

This base image wants you to have a go.mod and a Makefile where the default target creates the binary. This binary will be located in the path /work/bin/....

About

Builder image to create go applications.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Makefile 54.0%
  • Dockerfile 43.9%
  • Go 2.1%