8000 Switch to "debian:jessie" as the base and add new "stable" variant · cortex/golang@bfadd76 · GitHub
[go: up one dir, main page]

Skip to content

Commit bfadd76

Browse files
committed
Switch to "debian:jessie" as the base and add new "stable" variant
1 parent b271b2f commit bfadd76

File tree

6 files changed

+128
-5
lines changed

6 files changed

+128
-5
lines changed

1.2/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:wheezy
1+
FROM debian:jessie
22

33
# SCMs for "go get", gcc for cgo
44
RUN apt-get update && apt-get install -y \

1.3/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM debian:wheezy
1+
FROM debian:jessie
22

33
# SCMs for "go get", gcc for cgo
44
RUN apt-get update && apt-get install -y \

1.3/wheezy/Dockerfile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM debian:wheezy
2+
3+
# SCMs for "go get", gcc for cgo
4+
RUN apt-get update && apt-get install -y \
5+
ca-certificates curl gcc libc6-dev make \
6+
bzr git mercurial \
7+
--no-install-recommends \
8+
&& rm -rf /var/lib/apt/lists/*
9+
10+
ENV GOLANG_VERSION 1.3.3
11+
12+
RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
13+
| tar -v -C /usr/src -xz
14+
15+
RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1
16+
17+
ENV PATH /usr/src/go/bin:$PATH
18+
19+
RUN mkdir -p /go/src
20+
ENV GOPATH /go
21+
ENV PATH /go/bin:$PATH
22+
WORKDIR /go
23+
24+
COPY go-wrapper /usr/local/bin/

1.3/wheezy/go-wrapper

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
#!/bin/bash
2+
set -e
3+
4+
usage() {
5+
base="$(basename "$0")"
6+
cat <<EOUSAGE
7+
8+
usage: $base command [args]
9+
10+
This script assumes that is is run from the root of your Go package (for
11+
example, "/go/src/app" if your GOPATH is set to "/go").
12+
13+
The main feature of this wrapper over the native "go" tool is that it supports
14+
the addition of a ".godir" file in your package directory which is a plain text
15+
file that is the import path your application expects (ie, it would be something
16+
like "github.com/jsmith/my-cool-app"). If this file is found, the current
17+
package is then symlinked to /go/src/<.gopath> and the commands then use that
18+
full import path to act on it. This allows for applications to be universally
19+
cloned into a path like "/go/src/app" and then automatically built properly so
20+
that inter-package imports use the existing source instead of downloading it a
21+
second time. This also makes the final binary have the correct name (ie,
22+
instead of being "/go/bin/app", it can be "/go/bin/my-cool-app"), which is why
23+
the "run" command exists here.
24+
25+
Available Commands:
26+
27+
$base download
28+
$base download -u
29+
(equivalent to "go get -d [args] [godir]")
30+
31+
$base install
32+
$base install -race
33+
(equivalent to "go install [args] [godir]")
34+
35+
$base run
36+
$base run -app -specific -arguments
37+
(assumes "GOPATH/bin" is in "PATH")
38+
39+
EOUSAGE
40+
}
41+
42+
# "shift" so that "$@" becomes the remaining arguments and can be passed along to other "go" subcommands easily
43+
cmd="$1"
44+
if ! shift; then
45+
usage >&2
46+
exit 1
47+
fi
48+
49+
dir="$(pwd -P)"
50+
goBin="$(basename "$dir")" # likely "app"
51+
52+
goDir=
53+
if [ -f .godir ]; then
54+
goDir="$(cat .godir)"
55+
goPath="${GOPATH%%:*}" # this just grabs the first path listed in GOPATH, if there are multiple (which is the detection logic "go get" itself uses, too)
56+
goDirPath="$goPath/src/$goDir"
57+
mkdir -p "$(dirname "$goDirPath")"
58+
if [ -e "$goDirPath" -a ! -L "$goDirPath" ]; then
59+
echo >&2 "error: $goDirPath already exists but is unexpectedly not a symlink!"
60+
exit 1
61+
fi
62+
ln -sfv "$dir" "$goDirPath"
63+
goBin="$goPath/bin/$(basename "$goDir")"
64+
fi
65+
66+
case "$cmd" in
67+
download)
68+
execCommand=( go get -v -d "$@" )
69+
if [ "$goDir" ]; then execCommand+=( "$goDir" ); fi
70+
set -x; exec "${execCommand[@]}"
71+
;;
72+
73+
install)
74+
execCommand=( go install -v "$@" )
75+
if [ "$goDir" ]; then execCommand+=( "$goDir" ); fi
76+
set -x; exec "${execCommand[@]}"
77+
;;
78+
79+
run)
80+
set -x; exec "$goBin" "$@"
81+
;;
82+
83+
*)
84+
echo >&2 'error: unknown command:' "$cmd"
85+
usage >&2
86+
exit 1
87+
;;
88+
esac

generate-stackbrew-library.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ echo '# maintainer: InfoSiftr <github@infosiftr.com> (@infosiftr)'
1616
echo '# maintainer: Johan Euphrosine <proppy@google.com> (@proppy)'
1717

1818
for version in "${versions[@]}"; do
19-
commit="$(git log -1 --format='format:%H' "$version")"
19+
commit="$(git log -1 --format='format:%H' -- "$version")"
2020
fullVersion="$(grep -m1 'ENV GOLANG_VERSION ' "$version/Dockerfile" | cut -d' ' -f3)"
21+
[[ "$fullVersion" == *.*.* ]] || fullVersion+='.0'
2122
versionAliases=( $fullVersion $version ${aliases[$version]} )
2223

2324
echo
2425
for va in "${versionAliases[@]}"; do
2526
echo "$va: ${url}@${commit} $version"
2627
done
2728

28-
for variant in onbuild cross; do
29-
commit="$(git log -1 --format='format:%H' "$version/$variant")"
29+
for variant in onbuild cross wheezy; do
30+
[ -f "$version/$variant/Dockerfile" ] || continue
31+
commit="$(git log -1 --format='format:%H' -- "$version/$variant")"
3032
echo
3133
for va in "${versionAliases[@]}"; do
3234
if [ "$va" = 'latest' ]; then

update.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,13 @@ for version in "${versions[@]}"; do
1919
sed -ri 's/^(FROM golang):.*/\1:'"$versionTag"'/' "$version/"*"/Dockerfile"
2020
cp go-wrapper "$version/"
2121
)
22+
for variant in wheezy; do
23+
if [ -d "$version/$variant" ]; then
24+
(
25+
set -x
26+
cp "$version/Dockerfile" "$version/go-wrapper" "$version/$variant/"
27+
sed -i 's/^FROM .*/FROM debian:'"$variant"'/' "$version/$variant/Dockerfile"
28+
)
29+
fi
30+
done
2231
done

0 commit comments

Comments
 (0)
0