Skip to content

Commit

Permalink
Merge pull request #93 from atc0005/i92-add-cross-platform-debian-bui…
Browse files Browse the repository at this point in the history
…ld-image

Add cross-platform Debian build image
  • Loading branch information
atc0005 authored Oct 13, 2020
2 parents b227481 + 30050c8 commit 4674731
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ DOCKER_IMAGE_REGISTRY = registry-1.docker.io
#DOCKER_IMAGE_REGISTRY = index.docker.io
DOCKER_IMAGE_REGISTRY_USER = atc0005
DOCKER_IMAGE_REPO = go-ci
DOCKER_IMAGE_NAME_DEBIAN_BUILD = go-ci-stable-debian-build
DOCKER_IMAGE_NAME_ALPINE_BUILDX86 = go-ci-stable-alpine-buildx86
DOCKER_IMAGE_NAME_ALPINE_BUILDX64 = go-ci-stable-alpine-buildx64
DOCKER_IMAGE_NAME_STABLE = go-ci-stable
Expand Down Expand Up @@ -101,6 +102,15 @@ build:
-t $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_ALPINE_BUILDX86)-$(REPO_VERSION) \
--label=$(DOCKER_IMAGE_LABEL)

@echo "Building stable-debian-build release"
sudo docker build \
--no-cache \
--file stable/Dockerfile.debian-build \
stable/ \
-t $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_DEBIAN_BUILD) \
-t $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_DEBIAN_BUILD)-$(REPO_VERSION) \
--label=$(DOCKER_IMAGE_LABEL)

@echo "Building stable linting-only release"
sudo docker build \
--no-cache \
Expand Down Expand Up @@ -165,6 +175,8 @@ upload:
@sudo docker push $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_ALPINE_BUILDX86)-$(REPO_VERSION)
@sudo docker push $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_ALPINE_BUILDX64)
@sudo docker push $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_ALPINE_BUILDX64)-$(REPO_VERSION)
@sudo docker push $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_DEBIAN_BUILD)
@sudo docker push $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_DEBIAN_BUILD)-$(REPO_VERSION)
@sudo docker push $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_STABLE_LINT_ONLY)
@sudo docker push $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_STABLE_LINT_ONLY)-$(REPO_VERSION)
@sudo docker push $(DOCKER_IMAGE_REGISTRY)/$(DOCKER_IMAGE_REGISTRY_USER)/$(DOCKER_IMAGE_REPO):$(DOCKER_IMAGE_NAME_OLDSTABLE)
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Tooling for linting, testing and building Go applications
- [`go-ci-stable`](#go-ci-stable)
- [`go-ci-stable-alpine-buildx86`](#go-ci-stable-alpine-buildx86)
- [`go-ci-stable-alpine-buildx64`](#go-ci-stable-alpine-buildx64)
- [`go-ci-stable-debian-build`](#go-ci-stable-debian-build)
- [`go-ci-oldstable`](#go-ci-oldstable)
- [`go-ci-unstable`](#go-ci-unstable)
- [`go-ci-lint-only`](#go-ci-lint-only)
Expand Down Expand Up @@ -75,6 +76,14 @@ listing of available container images.

- same as `go-ci-stable-alpine-buildx86`, but specific to x64 architecture

### `go-ci-stable-debian-build`

- built from the latest version of the current stable `golang` image.
- used for building Go applications, both directly and via `Makefile` builds.
- supports cross-platform, static cgo-enabled builds for Windows and Linux
- Windows 32-bit: `i686-w64-mingw32-gcc`
- Windows 64-bit: `x86_64-w64-mingw32-gcc`

### `go-ci-oldstable`

- built from the latest version of the current outgoing stable `golang` image.
Expand Down
45 changes: 45 additions & 0 deletions stable/Dockerfile.debian-build
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright 2020 Adam Chalkley
#
# https://github.com/atc0005/go-ci
#
# Licensed under the MIT License. See LICENSE file in the project root for
# full license information.

# https://hub.docker.com/_/golang

FROM golang:1.15.2

ENV GOLANGCI_LINT_VERSION v1.31.0
ENV STATICCHECK_VERSION 2020.1.6
ENV APT_BSDMAINUTILS_VERSION 11.1.2+b1
ENV APT_TREE_VERSION 1.8.0-1
ENV APT_GCC_MULTILIB_VERSION 4:8.3.0-1
ENV APT_GCC_MINGW_W64_VERSION 8.3.0-6+21.3~deb10u1

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
bsdmainutils=${APT_BSDMAINUTILS_VERSION} \
tree=${APT_TREE_VERSION} \
gcc-multilib=${APT_GCC_MULTILIB_VERSION} \
gcc-mingw-w64=${APT_GCC_MINGW_W64_VERSION} \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

RUN GO111MODULE="on" go get honnef.co/go/tools/cmd/staticcheck@${STATICCHECK_VERSION} \
&& staticcheck --version \
&& go clean -cache -modcache \
&& curl -sSfLO https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
&& sh install.sh -b "$(go env GOPATH)/bin" ${GOLANGCI_LINT_VERSION} \
&& golangci-lint --version

# Copy over linting config files to root of container to serve as a default.
# Projects bringing their own config files (e.g., via GitHub Actions) can
# easily override these files, while projects choosing to use these config
# files exclusively can omit their copy.
#
# These files are copied from the root of this repo alongside this Dockerfile
# via Makefile `build` recipe. This allows for maintaining a single copy of
# either file in this repo vs each Dockerfile build "context" having their own
# separate copy.
COPY .markdownlint.yml /
COPY .golangci.yml /

0 comments on commit 4674731

Please sign in to comment.