157 lines
6.7 KiB
Docker
157 lines
6.7 KiB
Docker
FROM nurdism/neko
|
|
|
|
ARG USERNAME=neko
|
|
ARG USER_UID=1000
|
|
ARG USER_GID=$USER_UID
|
|
|
|
# Set to false to skip installing zsh and Oh My ZSH!
|
|
ARG INSTALL_ZSH="true"
|
|
|
|
# Location and expected SHA for common setup script - SHA generated on release
|
|
ARG COMMON_SCRIPT_SOURCE="https://raw.githubusercontent.com/microsoft/vscode-dev-containers/master/script-library/common-alpine.sh"
|
|
ARG COMMON_SCRIPT_SHA="dev-mode"
|
|
|
|
# Install git, bash, dependencies, and add a non-root user
|
|
RUN apk update \
|
|
&& apk add --no-cache wget coreutils ca-certificates \
|
|
&& apk add --no-cache wget openssl docker libxtst-dev xclip x11vnc glib-dev gobject-introspection \
|
|
#
|
|
# Verify git, common tools / libs installed, add/modify non-root user, optionally install zsh
|
|
&& wget -q -O /tmp/common-setup.sh $COMMON_SCRIPT_SOURCE \
|
|
&& if [ "$COMMON_SCRIPT_SHA" != "dev-mode" ]; then echo "$COMMON_SCRIPT_SHA /tmp/common-setup.sh" | sha256sum -c - ; fi \
|
|
&& /bin/ash /tmp/common-setup.sh "$INSTALL_ZSH" "$USERNAME" "$USER_UID" "$USER_GID" \
|
|
&& rm /tmp/common-setup.sh
|
|
|
|
ENV NODE_VERSION 13.7.0
|
|
RUN apk add --no-cache curl libstdc++ \
|
|
&& ARCH= && alpineArch="$(apk --print-arch)" \
|
|
&& case "${alpineArch##*-}" in \
|
|
x86_64) \
|
|
ARCH='x64' \
|
|
CHECKSUM="4c153345a08d2eeb40dfbb62f1ef6ade7ec369630f9cf9f061bf9d52b10acafc" \
|
|
;; \
|
|
*) ;; \
|
|
esac \
|
|
&& if [ -n "${CHECKSUM}" ]; then \
|
|
set -eu; \
|
|
curl -fsSLO --compressed "https://unofficial-builds.nodejs.org/download/release/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"; \
|
|
echo "$CHECKSUM node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" | sha256sum -c - \
|
|
&& tar -xJf "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz" -C /usr/local --strip-components=1 --no-same-owner \
|
|
&& ln -s /usr/local/bin/node /usr/local/bin/nodejs; \
|
|
else \
|
|
echo "Building from source" \
|
|
# backup build
|
|
&& apk add --no-cache binutils-gold g++ gcc gnupg libgcc linux-headers make python \
|
|
# gpg keys listed at https://github.com/nodejs/node#release-keys
|
|
&& for key in \
|
|
94AE36675C464D64BAFA68DD7434390BDBE9B9C5 \
|
|
FD3A5288F042B6850C66B31F09FE44734EB7990E \
|
|
71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 \
|
|
DD8F2338BAE7501E3DD5AC78C273792F7D83545D \
|
|
C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8 \
|
|
B9AE9905FFD7803F25714661B63B535A4C206CA9 \
|
|
77984A986EBC2AA786BC0F66B01FBB92821C587A \
|
|
8FCCA13FEF1D0C2E91008E09770F7A9A5AE15600 \
|
|
4ED778F539E3634C779C87C6D7062848A1AB005C \
|
|
A48C2BEE680E841632CD4E44F07496B3EB3C1762 \
|
|
B9E2F5981AA6E0CD28160D9FF13993A75599653C \
|
|
; do \
|
|
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
|
|
gpg --batch --keyserver hkp://ipv4.pool.sks-keyservers.net --recv-keys "$key" || \
|
|
gpg --batch --keyserver hkp://pgp.mit.edu:80 --recv-keys "$key" ; \
|
|
done \
|
|
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION.tar.xz" \
|
|
&& curl -fsSLO --compressed "https://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
|
&& gpg --batch --decrypt --output SHASUMS256.txt SHASUMS256.txt.asc \
|
|
&& grep " node-v$NODE_VERSION.tar.xz\$" SHASUMS256.txt | sha256sum -c - \
|
|
&& tar -xf "node-v$NODE_VERSION.tar.xz" \
|
|
&& cd "node-v$NODE_VERSION" \
|
|
&& ./configure \
|
|
&& make -j$(getconf _NPROCESSORS_ONLN) V= \
|
|
&& make install \
|
|
&& cd .. \
|
|
&& rm -Rf "node-v$NODE_VERSION" \
|
|
&& rm "node-v$NODE_VERSION.tar.xz" SHASUMS256.txt.asc SHASUMS256.txt; \
|
|
fi \
|
|
&& rm -f "node-v$NODE_VERSION-linux-$ARCH-musl.tar.xz"
|
|
|
|
ENV GOLANG_VERSION 1.13.6
|
|
RUN set -eux \
|
|
&& apk add --no-cache bash gcc musl-dev openssl go \
|
|
&& export \
|
|
# set GOROOT_BOOTSTRAP such that we can actually build Go
|
|
GOROOT_BOOTSTRAP="$(go env GOROOT)" \
|
|
# ... and set "cross-building" related vars to the installed system's values so that we create a build targeting the proper arch
|
|
# (for example, if our build host is GOARCH=amd64, but our build env/image is GOARCH=386, our build needs GOARCH=386)
|
|
GOOS="$(go env GOOS)" \
|
|
GOARCH="$(go env GOARCH)" \
|
|
GOHOSTOS="$(go env GOHOSTOS)" \
|
|
GOHOSTARCH="$(go env GOHOSTARCH)" \
|
|
; \
|
|
# also explicitly set GO386 and GOARM if appropriate
|
|
# https://github.com/docker-library/golang/issues/184
|
|
apkArch="$(apk --print-arch)"; \
|
|
case "$apkArch" in \
|
|
armhf) export GOARM='6' ;; \
|
|
armv7) export GOARM='7' ;; \
|
|
x86) export GO386='387' ;; \
|
|
esac; \
|
|
wget -O go.tgz "https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz"; \
|
|
echo 'aae5be954bdc40bcf8006eb77e8d8a5dde412722bc8effcdaf9772620d06420c *go.tgz' | sha256sum -c -; \
|
|
tar -C /usr/local -xzf go.tgz; \
|
|
rm go.tgz; \
|
|
cd /usr/local/go/src; \
|
|
./make.bash; \
|
|
rm -rf \
|
|
# https://github.com/golang/go/blob/0b30cf534a03618162d3015c8705dd2231e34703/src/cmd/dist/buildtool.go#L121-L125
|
|
/usr/local/go/pkg/bootstrap \
|
|
# https://golang.org/cl/82095
|
|
# https://github.com/golang/build/blob/e3fe1605c30f6a3fd136b561569933312ede8782/cmd/release/releaselet.go#L56
|
|
/usr/local/go/pkg/obj \
|
|
&& export PATH="/usr/local/go/bin:$PATH" \
|
|
&& go version
|
|
|
|
ENV GOPATH /go
|
|
ENV PATH $GOPATH/bin:/usr/local/go/bin:$PATH
|
|
|
|
#
|
|
# Install Go tools w/module support
|
|
RUN mkdir -p /tmp/gotools \
|
|
&& cd /tmp/gotools \
|
|
&& GO111MODULE=on go get -v golang.org/x/tools/gopls@latest 2>&1 \
|
|
&& GO111MODULE=on go get -v \
|
|
honnef.co/go/tools/...@latest \
|
|
golang.org/x/tools/cmd/gorename@latest \
|
|
golang.org/x/tools/cmd/goimports@latest \
|
|
golang.org/x/tools/cmd/guru@latest \
|
|
golang.org/x/lint/golint@latest \
|
|
github.com/mdempsky/gocode@latest \
|
|
github.com/cweill/gotests/...@latest \
|
|
github.com/haya14busa/goplay/cmd/goplay@latest \
|
|
github.com/sqs/goreturns@latest \
|
|
github.com/josharian/impl@latest \
|
|
github.com/davidrjenni/reftools/cmd/fillstruct@latest \
|
|
github.com/uudashr/gopkgs/cmd/gopkgs@latest \
|
|
github.com/ramya-rao-a/go-outline@latest \
|
|
github.com/acroca/go-symbols@latest \
|
|
github.com/godoctor/godoctor@latest \
|
|
github.com/rogpeppe/godef@latest \
|
|
github.com/zmb3/gogetdoc@latest \
|
|
github.com/fatih/gomodifytags@latest \
|
|
github.com/mgechev/revive@latest \
|
|
github.com/go-delve/delve/cmd/dlv@latest 2>&1 \
|
|
#
|
|
# Install Go tools w/o module support
|
|
&& go get -v github.com/alecthomas/gometalinter 2>&1 \
|
|
#
|
|
# Install gocode-gomod
|
|
&& go get -x -d github.com/stamblerre/gocode 2>&1 \
|
|
&& go build -o gocode-gomod github.com/stamblerre/gocode \
|
|
&& mv gocode-gomod $GOPATH/bin/ \
|
|
#
|
|
# Install golangci-lint
|
|
&& curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 2>&1
|
|
|
|
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" "$GOPATH/pkg/mod" && chmod -R 777 "$GOPATH"
|
|
|
|
ENV GO111MODULE=on |