Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go1.14/Makefile → go1.14/Debian7/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
IMAGES := base main darwin arm mips ppc s390x
IMAGES := base amd64

build:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) build || exit 1;)
Expand Down
26 changes: 26 additions & 0 deletions go1.14/Debian7/Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)/../Makefile.common

NAME := golang-crossbuild
VERSION := 1.14.6
DEBIAN_VERSION ?= 7
SUFFIX := -$(shell basename $(CURDIR))
TAG_EXTENSION ?=

export DEBIAN_VERSION TAG_EXTENSION

build:
@echo ">> Building $(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)"
@go run $(SELF_DIR)/../template.go -t Dockerfile.tmpl -o Dockerfile
@docker build -t "$(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)" \
--build-arg REPOSITORY=$(REPOSITORY) \
--build-arg VERSION=$(VERSION) \
--build-arg DEBIAN_VERSION=$(DEBIAN_VERSION) \
--build-arg TAG_EXTENSION=$(TAG_EXTENSION) \
--build-arg IMAGE="$(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)" \
--build-arg VCS_REF="$(VCS_REF)" \
--build-arg VCS_URL="$(VCS_URL)" \
--build-arg BUILD_DATE="$(BUILD_DATE)" \
.

.PHONY: build
File renamed without changes.
File renamed without changes.
70 changes: 70 additions & 0 deletions go1.14/Debian7/amd64/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
ARG REPOSITORY
ARG VERSION
ARG TAG_EXTENSION=
FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}

RUN \
dpkg --add-architecture amd64 \
&& apt-get -o Acquire::Check-Valid-Until=false update \
&& apt-get upgrade -qq -y \
&& apt-get install -y --no-install-recommends --allow-unauthenticated \
clang:amd64 \
g++:amd64 \
gcc:amd64 \
gcc-multilib:amd64 \
libc6 \
libc-bin \
libc6-dev:amd64 \
# libc6:amd64 \
# libc-bin:amd64 \
libdb5.1-dev:amd64 \
libdb5.1:amd64 \
libmagic1:amd64 \
linux-libc-dev:amd64 \
patch \
xz-utils \
librpm-dev:amd64 \
libpopt-dev:amd64 \
libxml2-dev:amd64 \
libxml2:amd64 \
libsystemd-journal-dev:amd64 \
libsystemd-daemon-dev:amd64 \
libsystemd-id128-dev:amd64 \
libsystemd-daemon0:amd64 \
libsystemd-id128-0:amd64 \
libsystemd-journal0:amd64 \
libpopt0:amd64 \
librpm3:amd64 \
librpmio3:amd64 \
librpmbuild3:amd64 \
librpmsign1:amd64 \
libdb-dev:amd64 \
libbz2-dev:amd64 \
libz-dev:amd64 \
libreadline-dev:amd64 \
libselinux1-dev:amd64 \
libsqlite3-dev:amd64 \
liblzma5:amd64 \
zlib1g:amd64 \
&& rm -rf /var/lib/apt/lists/*

COPY rootfs /

# Basic test
RUN cd / \
&& gcc helloWorld.c -o helloWorld \
&& file helloWorld \
&& readelf -h helloWorld \
# && file helloWorld | cut -d "," -f 2 | grep -c 'Intel 80386' \
&& rm helloWorld.c helloWorld

# Build-time metadata as defined at http://label-schema.org.
ARG BUILD_DATE
ARG IMAGE
ARG VCS_REF
ARG VCS_URL
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name=$IMAGE \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.schema-version="1.0"
File renamed without changes.
11 changes: 11 additions & 0 deletions go1.14/Debian7/amd64/rootfs/compilers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

windows:
386:
CC: i686-w64-mingw32-gcc
CXX: i686-w64-mingw32-g++

linux:
386:
CC: gcc
CXX: g++
5 changes: 5 additions & 0 deletions go1.14/Debian7/amd64/rootfs/helloWorld.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
ARG DEBIAN_VERSION
FROM debian:${DEBIAN_VERSION}

{{if or (eq .DEBIAN_VERSION "7") (eq .DEBIAN_VERSION "8") -}}
{{if (le .DEBIAN_VERSION "8") -}}
# Replace sources.list in order to use archive.debian.org.
COPY sources-debian{{.DEBIAN_VERSION}}.list /etc/apt/sources.list
{{- end}}

RUN \
apt-get -o Acquire::Check-Valid-Until=false update \
&& apt-get dist-upgrade -y \
&& apt-get install -y --no-install-recommends --allow-unauthenticated \
apt-get -qq -o Acquire::Check-Valid-Until=false update \
&& apt-get dist-upgrade -qq -y \
&& apt-get install -y \
--no-install-recommends \
--allow-unauthenticated \
build-essential \
ca-certificates \
curl \
Expand All @@ -21,9 +23,9 @@ RUN \
bison \
&& rm -rf /var/lib/apt/lists/*

ARG GOLANG_VERSION=1.14.4
ARG GOLANG_VERSION=1.14.6
ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ARG GOLANG_DOWNLOAD_SHA256=aed845e4185a0b2a3c3d5e1d0a35491702c55889192bb9c30e67a3de6849c067
ARG GOLANG_DOWNLOAD_SHA256=5c566ddc2e0bcfc25c26a5dc44a440fcc0177f7350c1f01952b34d5989a0d287

RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions go1.14/Debian7/base/sources-debian7.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deb http://archive.debian.org/debian wheezy main
deb [arch=amd64] http://archive.debian.org/debian-security wheezy/updates main
2 changes: 2 additions & 0 deletions go1.14/Debian7/base/sources-debian8.list
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deb http://archive.debian.org/debian jessie main
deb [arch=amd64] http://security.debian.org/debian-security jessie/updates main
10 changes: 10 additions & 0 deletions go1.14/Debian8/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
IMAGES := base amd64

build:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) build || exit 1;)

# Requires login at https://docker.elastic.co:7000/.
push:
@$(foreach var,$(IMAGES),$(MAKE) -C $(var) push || exit 1;)

.PHONY: build push
26 changes: 26 additions & 0 deletions go1.14/Debian8/Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
SELF_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(SELF_DIR)/../Makefile.common

NAME := golang-crossbuild
VERSION := 1.14.6
DEBIAN_VERSION ?= 8
SUFFIX := -$(shell basename $(CURDIR))
TAG_EXTENSION ?=

export DEBIAN_VERSION TAG_EXTENSION

build:
@echo ">> Building $(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)"
@go run $(SELF_DIR)/../template.go -t Dockerfile.tmpl -o Dockerfile
@docker build -t "$(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)" \
--build-arg REPOSITORY=$(REPOSITORY) \
--build-arg VERSION=$(VERSION) \
--build-arg DEBIAN_VERSION=$(DEBIAN_VERSION) \
--build-arg TAG_EXTENSION=$(TAG_EXTENSION) \
--build-arg IMAGE="$(REPOSITORY)/$(NAME):$(VERSION)$(SUFFIX)$(TAG_EXTENSION)" \
--build-arg VCS_REF="$(VCS_REF)" \
--build-arg VCS_URL="$(VCS_URL)" \
--build-arg BUILD_DATE="$(BUILD_DATE)" \
.

.PHONY: build
File renamed without changes.
File renamed without changes.
53 changes: 53 additions & 0 deletions go1.14/Debian8/amd64/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
ARG REPOSITORY
ARG VERSION
ARG TAG_EXTENSION=
FROM ${REPOSITORY}/golang-crossbuild:${VERSION}-base${TAG_EXTENSION}

RUN \
dpkg --add-architecture amd64 \
&& apt-get -o Acquire::Check-Valid-Until=false update \
&& apt-get install -y --no-install-recommends --allow-unauthenticated \
clang \
g++ \
gcc \
gcc-multilib \
#libc6-dev-amd64-cross \
#libc6-dev \
#libc6-dev-amd64 \
#linux-libc-dev:amd64 \
mingw-w64 \
mingw-w64-tools \
patch \
xz-utils \
librpm-dev:amd64 \
libc-dev:amd64 \
libpopt-dev:amd64 \
linux-libc-dev:amd64 \
libxml2-dev:amd64 \
libxml2:amd64 \
libicu-dev:amd64 \
#libicu57:amd64 \
icu-devtools:amd64 \
libsystemd-dev:amd64 \
&& rm -rf /var/lib/apt/lists/*

COPY rootfs /

# Basic test
RUN cd / \
&& gcc helloWorld.c -o helloWorld \
&& file helloWorld \
&& readelf -h helloWorld \
&& file helloWorld | cut -d "," -f 2 | grep -c 'x86-64' \
&& rm helloWorld.c helloWorld

# Build-time metadata as defined at http://label-schema.org.
ARG BUILD_DATE
ARG IMAGE
ARG VCS_REF
ARG VCS_URL
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name=$IMAGE \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url=$VCS_URL \
org.label-schema.schema-version="1.0"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ windows:
CC: x86_64-w64-mingw32-gcc
CXX: x86_64-w64-mingw32-g++

darwin:
386:
CC: o32-clang
CXX: o32-clang++
amd64:
CC: o64-clang
CXX: o64-clang++

linux:
386:
CC: gcc
Expand Down
5 changes: 5 additions & 0 deletions go1.14/Debian8/amd64/rootfs/helloWorld.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include <stdio.h>
int main() {
printf("Hello, World!");
return 0;
}
File renamed without changes.
51 changes: 51 additions & 0 deletions go1.14/Debian8/base/Dockerfile.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
ARG DEBIAN_VERSION
FROM debian:${DEBIAN_VERSION}

{{if (le .DEBIAN_VERSION "8") -}}
# Replace sources.list in order to use archive.debian.org.
COPY sources-debian{{.DEBIAN_VERSION}}.list /etc/apt/sources.list
{{- end}}

RUN \
apt-get -qq -o Acquire::Check-Valid-Until=false update \
&& apt-get dist-upgrade -qq -y \
&& apt-get install -y \
--no-install-recommends \
--allow-unauthenticated \
build-essential \
ca-certificates \
curl \
git \
gnupg \
make \
file \
flex \
bison \
&& rm -rf /var/lib/apt/lists/*

ARG GOLANG_VERSION=1.14.6
ARG GOLANG_DOWNLOAD_URL=https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ARG GOLANG_DOWNLOAD_SHA256=5c566ddc2e0bcfc25c26a5dc44a440fcc0177f7350c1f01952b34d5989a0d287

RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
&& tar -C /usr/local -xzf golang.tar.gz \
&& rm golang.tar.gz

ENV GOPATH /go
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH

RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
WORKDIR $GOPATH

COPY rootfs /

WORKDIR /
RUN go get -d . \
&& go build -o /crossbuild /entrypoint.go \
&& rm -rf /go/* /root/.cache/* /entrypoint.go

ENV GOLANG_CROSSBUILD=1
VOLUME /app
WORKDIR /app
ENTRYPOINT ["/crossbuild"]
File renamed without changes.
Loading