Skip to content

Commit 0ec1c52

Browse files
committed
feat(Dockerfile): go-dev updates for smaller image
- update base image to `ubuntu:20.04` focal lts - switch to `golangci-lint` for linter as `gometalinter` is DEPRECATED - `golint` is DEPRECATED in favor of drop-in replacement `revive` - enable `typecheck` linter as mandatory (pretty quiet linter) - enable `gosec`, `gocritic`, and `gocognit` as optional linters (useful) - drop library `libicu60` for library `libc6` that exists in focal - removing unused Azure packages like `azcopy`, `packer`, and many others etc. Signed-off-by: Cryptophobia <aouzounov@gmail.com>
1 parent e9e529f commit 0ec1c52

4 files changed

Lines changed: 32 additions & 62 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
VERSION ?= $(shell git describe --tags --exact-match 2>/dev/null || echo latest)
2-
REGISTRY ?= quay.io/
3-
IMAGE_PREFIX ?= deis
2+
REGISTRY ?= docker.io/
3+
IMAGE_PREFIX ?= hephy
44
IMAGE := ${REGISTRY}${IMAGE_PREFIX}/go-dev:${VERSION}
55

66
# scripts are checked *after* build, so use paths inside the container

README.md

Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
# deis/go-dev
1+
# hephy/go-dev
22

3-
[![Build Status](https://github.com/deis/docker-go-dev/actions/workflows/docker-publish.yml/badge.svg)](https://quay.io/repository/deis/go-dev?tab=tags)
3+
[![Build Status](https://github.com/teamhephy/docker-go-dev/actions/workflows/docker-publish.yml/badge.svg)](https://hub.docker.com/r/hephy/go-dev/tags)
44

55
A [Go][] language development toolbox.
66

7-
Some Azure projects use this Docker image as a standard build and test environment,
8-
but it is intended to be useful to any Go developer. Please help make deis/go-dev better by
7+
This image is intended to be useful to any Go developer. Please help make hephy/go-dev better by
98
creating [issues][] and submitting [pull requests][].
109

1110
## Image Contents
1211

13-
* based on [Ubuntu 18.04][]
14-
* [az][]: Azure cloud command-line tool
15-
* [azcopy][]: Utility for copying data to/from Microsoft Azure Blob and File storage
12+
* based on [Ubuntu 20.04][]
1613
* [delve][]: debugger for the Go programming language
1714
* [Docker][]: Docker binaries to be able to bind mount /var/run/docker.sock in the dev environment container
1815
* [ginkgo][]: BDD testing framework for Go
@@ -25,7 +22,6 @@ creating [issues][] and submitting [pull requests][].
2522
* [jwt][]: tool for creating and parsing JSON Web Tokens
2623
* [k][]: automatically run the correct version of `kubectl` every time
2724
* [kubectl][]: Kubernetes command-line client
28-
* [Packer][]: build automated machine images
2925
* [ruby][]: ruby scripting language
3026
* [shellcheck][]: static analysis for shell scripts
3127
* [shfmt][]: shell script parser, formatter, and interpreter
@@ -39,37 +35,26 @@ creating [issues][] and submitting [pull requests][].
3935
## Usage
4036

4137
Mount your local Go code into a container's `$GOPATH` to run any `go` command or one of the
42-
included tools or scripts. Here's an example of running `ginko` for deis/builder:
38+
included tools or scripts. Here's an example of running `ginko` for teamhephy/builder:
4339

4440
```console
4541
$ docker run --rm \
46-
--volume $GOPATH/src/github.com/deis/builder:/go/src/github.com/deis/builder \
47-
--workdir /go/src/github.com/deis/builder \
48-
quay.io/deis/go-dev:latest \
42+
--volume $GOPATH/src/github.com/teamhephy/builder:/go/src/github.com/teamhephy/builder \
43+
--workdir /go/src/github.com/teamhephy/builder \
44+
hephy/go-dev:latest \
4945
ginkgo -r
5046
```
5147

5248
## Releases
5349

54-
The latest deis/go-dev Docker image is available at:
55-
56-
* [Microsoft Container Registry][]
57-
```
58-
docker pull mcr.microsoft.com/oss/azcu/go-dev:<tag>
59-
```
60-
Browse the [go-dev index URL][] to see which tags are available.
61-
62-
* [Quay.io][]
63-
```
64-
docker pull quay.io/deis/go-dev
65-
```
50+
The latest hephy/go-dev Docker image is available at:
6651

6752
* [Docker Hub][]
6853
```
69-
docker pull deis/go-dev
54+
docker pull hephy/go-dev
7055
```
7156

72-
To publish a new release of deis/go-dev, use the [deisrel][] tool:
57+
To publish a new release of hephy/go-dev, use the [deisrel][] tool:
7358

7459
```console
7560
$ deisrel release docker-go-dev v1.28.7
@@ -86,36 +71,30 @@ If the CHANGELOG contents look correct, run the same command again but add the a
8671
You will be prompted to confirm again before any tag or release is written to GitHub.
8772

8873

89-
[az]: https://github.com/Azure/azure-cli#readme
90-
[azcopy]: https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-linux?toc=%2fazure%2fstorage%2ffiles%2ftoc.json
91-
[deisrel]: https://github.com/deis/deisrel
74+
[deisrel]: https://github.com/teamhephy/deisrel
9275
[delve]: https://github.com/go-delve/delve
9376
[Docker Hub]: https://hub.docker.com
9477
[Docker]: http://www.docker.com
95-
[gen-changelog.sh]: https://github.com/deis/docker-go-dev/tree/master/rootfs/usr/local/bin/gen-changelog.sh
78+
[gen-changelog.sh]: https://github.com/teamhephy/docker-go-dev/tree/master/rootfs/usr/local/bin/gen-changelog.sh
9679
[ginkgo]: https://github.com/onsi/ginkgo
9780
[go-bindata]: https://github.com/jteeuwen/go-bindata
9881
[Go]: https://golang.org/
99-
[go-dev index URL]: https://mcr.microsoft.com/v2/oss/azcu/go-dev/tags/list
10082
[golangci-lint]: https://github.com/golangci/golangci-lint
10183
[goss]: https://github.com/aelsabbahy/goss
10284
[gox]: https://github.com/mitchellh/gox
10385
[helm]: https://github.com/kubernetes/helm
104-
[issues]: https://github.com/deis/docker-go-dev/issues
86+
[issues]: https://github.com/teamhephy/docker-go-dev/issues
10587
[jq]: https://stedolan.github.io/jq/
10688
[jwt]: https://github.com/dgrijalva/jwt-go
10789
[k]: https://github.com/jakepearson/k
10890
[kubectl]: https://kubernetes.io/docs/user-guide/kubectl-overview/
109-
[Microsoft Container Registry]: https://github.com/microsoft/containerregistry
110-
[pull requests]: https://github.com/deis/docker-go-dev/pulls
111-
[Quay.io]: https://quay.io
112-
[Packer]: https://github.com/hashicorp/packer
91+
[pull requests]: https://github.com/teamhephy/docker-go-dev/pulls
11392
[ruby]: https://www.ruby-lang.org/
11493
[shellcheck]: https://github.com/koalaman/shellcheck
11594
[shfmt]: https://github.com/mvdan/sh
11695
[shyaml]: https://github.com/0k/shyaml
117-
[test-cover.sh]: https://github.com/deis/docker-go-dev/tree/master/rootfs/usr/local/bin/test-cover.sh
118-
[Ubuntu 18.04]: https://hub.docker.com/_/ubuntu/
96+
[test-cover.sh]: https://github.com/teamhephy/docker-go-dev/tree/master/rootfs/usr/local/bin/test-cover.sh
97+
[Ubuntu 20.04]: https://hub.docker.com/_/ubuntu/
11998
[unzip]: https://linux.die.net/man/1/unzip
12099
[upx]: http://upx.sourceforge.net/
121100
[vim]: http://www.vim.org/

rootfs/Dockerfile

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
1-
FROM ubuntu:18.04
1+
FROM ubuntu:20.04
22

3-
LABEL name="deis-go-dev" \
4-
maintainer="Matt Boersma <matt.boersma@microsoft.com>"
3+
LABEL name="hephy-go-dev" \
4+
maintainer="Team Hephy <team@teamhephy.com>"
55

6-
ENV ANSIBLE_VERSION=2.10.9 \
7-
AZCLI_VERSION=2.26.1 \
8-
DOCKER_VERSION=20.10.2 \
6+
ENV DOCKER_VERSION=20.10.2 \
97
ETCDCTL_VERSION=v3.1.8 \
108
GO_VERSION=1.16.6 \
119
GOLANGCI_LINT_VERSION=v1.41.1 \
1210
GOSS_VERSION=v0.3.16 \
1311
HELM_VERSION=3.6.2 \
1412
KUBECTL_VERSION=v1.21.3 \
15-
PACKER_VERSION=1.7.3 \
1613
PROTOBUF_VERSION=3.7.0 \
17-
PYJWT_VERSION=2.1.0 \
18-
PYWINRM_VERSION=0.4.1 \
1914
SHELLCHECK_VERSION=v0.7.2 \
2015
SHFMT_VERSION=3.3.0 \
2116
UPX_VERSION=3.96 \
@@ -40,7 +35,7 @@ RUN \
4035
git-core \
4136
jq \
4237
libffi-dev \
43-
libicu60 \
38+
libc6 \
4439
libssl-dev \
4540
libunwind8 \
4641
man \
@@ -73,10 +68,6 @@ RUN \
7368
&& chmod 700 get_helm.sh && ./get_helm.sh --version v${HELM_VERSION} \
7469
&& rm ./get_helm.sh \
7570
&& mkdir -p /go/bin \
76-
&& curl -sSL https://aka.ms/downloadazcopy-v10-linux | tar -vxz -C /usr/local/bin --strip=1 \
77-
&& mv /usr/local/bin/azcopy /usr/local/bin/azcopy-preview \
78-
&& curl -sSL https://aka.ms/downloadazcopylinux64 | tar -vxz -C /tmp \
79-
&& /tmp/install.sh \
8071
&& apt-get update && apt-get -f -y install \
8172
&& curl -fsSLO https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz \
8273
&& tar xzvf docker-${DOCKER_VERSION}.tgz -C /usr/local/bin \
@@ -99,8 +90,6 @@ RUN \
9990
&& curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b ${GOPATH}/bin ${GOLANGCI_LINT_VERSION} \
10091
&& curl -sSL https://github.com/koalaman/shellcheck/releases/download/${SHELLCHECK_VERSION}/shellcheck-${SHELLCHECK_VERSION}.linux.x86_64.tar.xz \
10192
| tar -vxJ -C /usr/local/bin --strip=1 \
102-
&& curl -sSL https://releases.hashicorp.com/packer/${PACKER_VERSION}/packer_${PACKER_VERSION}_linux_amd64.zip -o /tmp/packer.zip \
103-
&& unzip /tmp/packer.zip -d /usr/local/bin \
10493
&& curl -o /usr/local/bin/shfmt -sSL https://github.com/mvdan/sh/releases/download/v{SHFMT_VERSION}/shfmt_v{SHFMT_VERSION}_linux_amd64 \
10594
&& chmod +x /usr/local/bin/shfmt \
10695
&& curl -L "https://github.com/aelsabbahy/goss/releases/download/${GOSS_VERSION}/goss-linux-amd64" -o /usr/local/bin/goss \
@@ -111,8 +100,6 @@ RUN \
111100
&& tar -xvf /tmp/upx.tar.xz -C /tmp \
112101
&& mv /tmp/upx-${UPX_VERSION}-amd64_linux/upx /usr/local/bin/upx \
113102
&& pip3 install --disable-pip-version-check --no-cache-dir --upgrade pip \
114-
&& pip3 install --disable-pip-version-check --no-cache-dir azure-cli==${AZCLI_VERSION} PyJWT==${PYJWT_VERSION} shyaml ansible-base==${ANSIBLE_VERSION} pywinrm==${PYWINRM_VERSION} \
115-
&& ansible-galaxy collection install ansible.windows \
116103
&& apt-get purge --auto-remove -y libffi-dev python3-dev \
117104
&& apt-get autoremove -y \
118105
&& apt-get clean -y \

rootfs/usr/local/bin/lint

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,25 @@
22

33
# Mandatory tests
44
echo -e "\033[0;31mManadatory Linters: These must pass\033[0m"
5-
gometalinter --vendor --tests --deadline=300s --disable-all \
5+
golangci-lint run --modules-download-mode=vendor --tests --deadline=300s --disable-all \
66
--enable=gofmt \
77
--enable=misspell \
88
--enable=deadcode \
99
--enable=ineffassign \
1010
--enable=gosimple \
11-
--enable=vet \
11+
--enable=govet \
12+
--enable=typecheck \
1213
./...
1314

1415
mandatory=$?
1516

1617
# Optional tests
1718
echo -e "\033[0;32mOptional Linters: These should pass\033[0m"
18-
gometalinter --vendor --tests --deadline=300s --disable-all \
19-
--enable=golint \
19+
golangci-lint run --modules-download-mode=vendor --tests --deadline=300s --disable-all \
20+
--enable=revive \
21+
--enable=gosec \
22+
--enable=gocognit \
23+
--enable=gocritic \
2024
./...
2125

2226
exit $mandatory

0 commit comments

Comments
 (0)