Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/metal-stack/builder
Builder image to create go applications.
https://github.com/metal-stack/builder
dockerfile golang
Last synced: 3 months ago
JSON representation
Builder image to create go applications.
- Host: GitHub
- URL: https://github.com/metal-stack/builder
- Owner: metal-stack
- License: mit
- Created: 2020-02-03T14:24:27.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-11T13:38:22.000Z (3 months ago)
- Last Synced: 2024-11-11T14:33:01.667Z (3 months ago)
- Topics: dockerfile, golang
- Language: Makefile
- Size: 73.2 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# Common Builder
## Makefile
Use this repository in your Makefile by including it:
```Makefile
BINARY := metal-api
MAINMODULE :=
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, etc.).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:
```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/...`.