• Stars
    star
    666
  • Rank 67,428 (Top 2 %)
  • Language
    Shell
  • License
    BSD 3-Clause "New...
  • Created about 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Package golang service into minimal docker containers.

gockerize

Build static golang binaries and package them into minimal docker containers

gockerize

License

BSD 3-Clause, see accompanying LICENSE file.

Requirements

  • bash
  • docker 1.5+

Usage

gockerize <image> <package> [<source> [<mapping> [<Dockerfile>]]]

The default use case is to call the script from the root directory of the package being built, with any dependencies vendored in and the Dockerfile at the root of the package.

Arguments

The image argument determines the name of the resulting Docker image.

The package argument is the fully qualified name of the package being built.

The source argument can be used to easily include non-vendored dependencies into the build context. For instance, given the following hierarchy:

src/
    acme.com/
        common/
        foo/

Where foo is the service to be built and common is a package it depends on.

The following command can be used, from src/acme.com/foo :

gockerize foo acme.com/foo ..

This will result in all of src/acme.com being used as build context, under $GOPATH/src/acme.com.

Similarly, mapping can be changed from its default value to accommodate source layouts that deviate from golang's conventions and Dockerfile can point to a Dockerfile at a non-default location, including outside of the Docker build context.

The contents of the GOARGS environment variable are passed to the go build command inside the container. Among other things, this makes it easy to use custom build tags.

Dockerfile

A typical Dockerfile may look like:

FROM scratch
ADD bin/foo /foo
EXPOSE 12345
ENTRYPOINT [ "/foo" ]

The Docker image is built within a temporary container and its build context is limited to the content of GOPATH on that container, hence the reference to bin/foo which is the location of the binary produced by compiling package acme.com/foo.

Dependency resolution

For ease of use, gockerize uses go get to automatically fetch remote dependencies from github and other public repositories supported by default, however, vendored dependencies should be preferred as they ensure repeatable build.

By default, gockerize uses Go 1.5.3 and enables GOVENDOREXPERIMENT. However, it is possible to use any desired version of Go by setting the GOVERSION environment variable appropriately, for instance GOVERSION=1.9.2 to build with Go 1.9.2

Patching standard lib

Fully static builds allow easy patching of the standard library. gockerize leverages that by automatically applying patches found in the patches subdir of the package being built.

Care should be taken that the patches cleanly apply against the version of Go used in the container (1.5.3 at this time).

More Repositories

1

teambox

This is the legacy version of Teambox - the award-winning collaboration solution, inspired by Basecamp, Yammer and Twitter.
Ruby
1,864
star
2

react-native-auto-updater

A library to manage dynamic updates to React Native apps. Available as an NPM Package for iOS and Android.
Objective-C
1,509
star
3

free-file-icons

Platform-agnostic icons for audio, image, programming and office files.
611
star
4

scrum-poker-cards

588
star
5

backbone-redux

Easy way to keep your backbone collections and redux store in sync.
JavaScript
191
star
6

viper-module-generator

Gem to generate VIPER modules to use them in your Objective-C/Swift projects.
Ruby
162
star
7

ssmp

Stupid-Simple Messaging Protocol.
122
star
8

lipwig

Golang implementation of the Stupid-Simple Messaging Protocol.
Go
98
star
9

departure

Percona's pt-online-schema-change runner for ActiveRecord migrations.
Ruby
86
star
10

SimplePagedView

A UIPageViewController replacement built to be as simple as possible
Swift
75
star
11

immortal

Make any ActiveRecord model paranoid by just including Immortal, and instead of being deleted from the database, the object will just marked as 'deleted' with a boolean field in the database.
Ruby
60
star
12

openjdk-trim

Tool to trim unneeded classes from an OpenJDK build.
Shell
47
star
13

react-native-quick-look

React Native Component for iOS QuickLook Framework.
Objective-C
37
star
14

aerofs-docker

Ready-to-use cloud-config file for the AeroFS appliance.
Shell
34
star
15

jssmp

Java implementation of the Stupid-Simple Messaging Protocol
Java
25
star
16

planning-time-android

Redbooth's planning poker app for Android.
Java
21
star
17

jnotify

Java bindings for native notification libraries.
C++
20
star
18

ssmperf

Load testing tool for SSMP servers.
Go
18
star
19

nps-surveys

Rails engine to add NPS surveys to your application.
Ruby
17
star
20

teambox-ruby-client

Ruby gem to access Teambox API
Ruby
16
star
21

npm-shrinkwrap-check

Util to check that package.json and npm-shrinkwrap.json are in sync.
JavaScript
14
star
22

fastqrcode

Fast and robust Python bindings for libqrencode.
C
11
star
23

redbooth-ruby

This is a Ruby wrapper for Redbooth's API.
Ruby
10
star
24

gerrit-slack-hooks

Make noise in Slack for Gerrit actions.
Shell
9
star
25

classy-immutable

Immutable instances of ES6 classes.
JavaScript
9
star
26

zendesk-elasticsearch

Index Zendesk tickets in Elasticsearch for easy searching.
Ruby
9
star
27

growl-java-bindings

Objective-C
8
star
28

rubocop-migrations

Ruby
5
star
29

aerofs-sdk-python

An AeroFS Private Cloud API SDK written in Python.
Python
4
star
30

SimpleNotificationBar

Swift
4
star
31

https-pushstate-server

A simple static file server that works with HTML5 Pushstate and HTTPS.
JavaScript
3
star
32

zendesk-help-center-backer

Back your Zendesk Help Center in git. Modify articles locally, and deploy directly to Zendesk.
Python
3
star
33

valkyrie

Golang implementation of the Zephyr relay protocol.
Go
3
star
34

aerofs-sdk-csharp

An AeroFS Private Cloud API SDK written in C#.
C#
2
star
35

retrace-server

Fast and simple TCP Server around Proguard's Retrace tool.
Java
2
star
36

fake-consul

Fakes a consul server. Usecase is for feature specs using Diplomat client
Ruby
2
star
37

api-docs

API v3 Documentation (depreciated).
CSS
2
star
38

aerofs-sdk-golang

An AeroFS Private Cloud API SDK written in Golang.
Go
1
star
39

aeroup

Secure AeroFS upload service. Send link, receive file.
JavaScript
1
star
40

switchboard

A service to perform real-time transcription and translation of audio streams.
Go
1
star
41

rbo-auth2-manager

AFOAuth2Manager in a Framework
Objective-C
1
star
42

freshdesk-help-center-backer

Back your Freshdesk Help Center in git. Modify articles locally, and deploy directly to Freshdesk.
Python
1
star