Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 9e43b09

Browse files
authored
Update for Go 1.15 (#2)
* Update for go 1.15 support * Add pipeline
1 parent df57ae0 commit 9e43b09

File tree

7 files changed

+76
-46
lines changed

7 files changed

+76
-46
lines changed

.dockerignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
.git
22
docker-gen
3-
dist
43
*.gz

.travis.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ FROM alpine:latest
22

33
RUN apk -U add openssl
44

5-
ENV VERSION 0.7.5-cr1
6-
ENV DOWNLOAD_URL https://github.com/coderedcorp/docker-gen/releases/download/$VERSION/docker-gen-alpine-linux-amd64-$VERSION.tar.gz
75
ENV DOCKER_HOST unix:///tmp/docker.sock
86

9-
RUN wget -qO- $DOWNLOAD_URL | tar xvz -C /usr/local/bin
7+
COPY dist/alpine-linux/amd64/docker-gen /usr/local/bin/
108

119
ENTRYPOINT ["/usr/local/bin/docker-gen"]

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ dist: dist-clean
2626
mkdir -p dist/linux/armel && CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "$(LDFLAGS)" -o dist/linux/armel/docker-gen ./cmd/docker-gen
2727
mkdir -p dist/linux/armhf && CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "$(LDFLAGS)" -o dist/linux/armhf/docker-gen ./cmd/docker-gen
2828
mkdir -p dist/darwin/amd64 && CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o dist/darwin/amd64/docker-gen ./cmd/docker-gen
29-
mkdir -p dist/darwin/i386 && CGO_ENABLED=0 GOOS=darwin GOARCH=386 go build -ldflags "$(LDFLAGS)" -o dist/darwin/i386/docker-gen ./cmd/docker-gen
3029

3130

3231
release: dist
@@ -40,7 +39,6 @@ release: dist
4039
tar -cvzf docker-gen-linux-armel-$(TAG).tar.gz -C dist/linux/armel docker-gen
4140
tar -cvzf docker-gen-linux-armhf-$(TAG).tar.gz -C dist/linux/armhf docker-gen
4241
tar -cvzf docker-gen-darwin-amd64-$(TAG).tar.gz -C dist/darwin/amd64 docker-gen
43-
tar -cvzf docker-gen-darwin-i386-$(TAG).tar.gz -C dist/darwin/i386 docker-gen
4442

4543
get-deps:
4644
go get github.com/robfig/glock

README.md

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,58 @@
1-
docker-gen (built with go 1.11)
2-
=====
1+
docker-gen (built with Go 1.15)
2+
===============================
33

4-
Forked from jwilder/docker-gen.
4+
[![Build Status](https://dev.azure.com/coderedcorp/cr-github/_apis/build/status/docker-gen?branchName=master)](https://dev.azure.com/coderedcorp/cr-github/_build/latest?definitionId=14&branchName=master)
55

6-
To build:
6+
Originally forked from https://github.com/jwilder/docker-gen. This fork is
7+
supported and maintained by CodeRed for production use.
78

8-
1. Install Go 1.11.
9-
```
10-
$ wget https://dl.google.com/go/go1.11.4.linux-amd64.tar.gz
11-
$ sudo tar -C /usr/local -xzf go1.11.4.linux-amd64.tar.gz
12-
$ sudo ln -s /usr/local/go/bin/* /usr/local/bin/
13-
```
9+
## Environment Setup & Build
1410

15-
2. Install glock and add go downloads to path.
16-
```
17-
$ go get github.com/robfig/glock
18-
$ export PATH=$PATH:~/go/bin/
19-
```
11+
Environment requires a Linux (or WSL) OS.
2012

21-
3. Install dockger-gen (this seems a bit recursive, but I don't really know go that well)
22-
```
23-
$ go get github.com/coderedcorp/docker-gen
24-
```
13+
1. Install Go 1.15.
14+
15+
```
16+
$ wget -O golang.tar.gz https://golang.org/dl/go1.15.2.linux-amd64.tar.gz
17+
$ sudo tar -C /usr/local -xzf golang.tar.gz
18+
$ sudo ln -s /usr/local/go/bin/* /usr/local/bin/
19+
```
20+
21+
Confirm it is installed with:
22+
23+
```
24+
$ go version
25+
```
26+
27+
2. Add Go bin to PATH.
28+
29+
```
30+
$ export PATH=$PATH:~/go/bin/
31+
```
32+
33+
3. Clone this repo, and enter the project directory.
2534

2635
4. Now you can build. This will create a binary `docker-gen` in the current directory.
27-
```
28-
make get-deps
29-
make
30-
```
36+
37+
```
38+
make get-deps
39+
make
40+
```
3141

3242
5. To publish, make sure to tag the repo (the version is pulled from the tag). Then run:
3343
```
3444
make release
3545
```
36-
which will build for all architectures. Upload the archives to the github release.
46+
which will build for all architectures. Upload the archives to the GitHub release.
3747

3848
Original readme below.
3949

40-
---
50+
----
4151

4252

4353
docker-gen
4454
=====
4555

46-
![latest 0.7.3](https://img.shields.io/badge/latest-0.7.3-green.svg?style=flat)
47-
[![Build Status](https://travis-ci.org/jwilder/docker-gen.svg?branch=master)](https://travis-ci.org/jwilder/docker-gen)
48-
![License MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat)
49-
5056
`docker-gen` is a file generator that renders templates using docker container meta-data.
5157

5258
It can be used to generate various kinds of files for:
@@ -493,4 +499,3 @@ $ make
493499
### License
494500

495501
MIT
496-

azure-pipelines.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
trigger:
2+
- master
3+
4+
pool:
5+
vmImage: "ubuntu-latest"
6+
7+
steps:
8+
9+
- task: GoTool@0
10+
inputs:
11+
version: "1.15.*"
12+
13+
- script: |
14+
echo "##vso[task.prependpath]/home/vsts/go/bin"
15+
go env
16+
displayName: "Go environment"
17+
18+
- script: make get-deps
19+
displayName: "Install deps"
20+
21+
- script: make all
22+
displayName: "Build"
23+
24+
- script: make check-gofmt
25+
displayName: "Lint"
26+
27+
- script: make test
28+
displayName: "Test"
29+
30+
- script: make dist
31+
displayName: "Build dist"
32+
33+
- task: Docker@2
34+
displayName: "Build docker"
35+
inputs:
36+
command: build
37+
buildContext: ./
38+
Dockerfile: ./Dockerfile

cmd/docker-gen/main.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ import (
1010

1111
"github.com/BurntSushi/toml"
1212
docker "github.com/fsouza/go-dockerclient"
13-
"github.com/coderedcorp/docker-gen"
13+
14+
"../.."
1415
)
1516

1617
type stringslice []string

0 commit comments

Comments
 (0)