mirror of
https://github.com/alrayyes/hugo-node-ruby-docker
synced 2023-11-14 15:56:28 +00:00
copied ruby & node commands from official repositories
This commit is contained in:
parent
198dd6c35e
commit
a8394ce286
62
Dockerfile
62
Dockerfile
@ -1,6 +1,66 @@
|
|||||||
FROM golang
|
FROM golang
|
||||||
MAINTAINER Ryan Kes <ryan@andthensome.nl>
|
MAINTAINER Ryan Kes <ryan@andthensome.nl>
|
||||||
|
|
||||||
|
# Install Hugo
|
||||||
RUN wget https://github.com/spf13/hugo/releases/download/v0.14/hugo_0.14_amd64.deb \
|
RUN wget https://github.com/spf13/hugo/releases/download/v0.14/hugo_0.14_amd64.deb \
|
||||||
&& dpkg -i hugo_0.14_amd64.deb \
|
&& dpkg -i hugo_0.14_amd64.deb \
|
||||||
&& rm hugo_0.14_amd64.deb \
|
&& rm hugo_0.14_amd64.deb \
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install npm
|
||||||
|
# verify gpg and sha256: http://nodejs.org/dist/v0.10.30/SHASUMS256.txt.asc
|
||||||
|
# gpg: aka "Timothy J Fontaine (Work) <tj.fontaine@joyent.com>"
|
||||||
|
RUN gpg --keyserver pool.sks-keyservers.net --recv-keys 7937DFD2AB06298B2293C3187D33FF9D0246406D
|
||||||
|
|
||||||
|
ENV NODE_VERSION 0.11.14
|
||||||
|
ENV NPM_VERSION 2.1.18
|
||||||
|
|
||||||
|
RUN curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-x64.tar.gz" \
|
||||||
|
&& curl -SLO "http://nodejs.org/dist/v$NODE_VERSION/SHASUMS256.txt.asc" \
|
||||||
|
&& gpg --verify SHASUMS256.txt.asc \
|
||||||
|
&& grep " node-v$NODE_VERSION-linux-x64.tar.gz\$" SHASUMS256.txt.asc | sha256sum -c - \
|
||||||
|
&& tar -xzf "node-v$NODE_VERSION-linux-x64.tar.gz" -C /usr/local --strip-components=1 \
|
||||||
|
&& rm "node-v$NODE_VERSION-linux-x64.tar.gz" SHASUMS256.txt.asc \
|
||||||
|
&& npm install -g npm@"$NPM_VERSION" \
|
||||||
|
&& npm cache clear
|
||||||
|
|
||||||
|
# Install Ruby & Bundler
|
||||||
|
ENV RUBY_MAJOR 2.2
|
||||||
|
ENV RUBY_VERSION 2.2.3
|
||||||
|
ENV RUBY_DOWNLOAD_SHA256 df795f2f99860745a416092a4004b016ccf77e8b82dec956b120f18bdc71edce
|
||||||
|
ENV RUBYGEMS_VERSION 2.5.0
|
||||||
|
|
||||||
|
# skip installing gem documentation
|
||||||
|
RUN echo 'install: --no-document\nupdate: --no-document' >> "$HOME/.gemrc"
|
||||||
|
|
||||||
|
# some of ruby's build scripts are written in ruby
|
||||||
|
# we purge this later to make sure our final image uses what we just built
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y bison libgdbm-dev ruby autoconf \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& mkdir -p /usr/src/ruby \
|
||||||
|
&& curl -fSL -o ruby.tar.gz "http://cache.ruby-lang.org/pub/ruby/$RUBY_MAJOR/ruby-$RUBY_VERSION.tar.gz" \
|
||||||
|
&& echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.gz" | sha256sum -c - \
|
||||||
|
&& tar -xzf ruby.tar.gz -C /usr/src/ruby --strip-components=1 \
|
||||||
|
&& rm ruby.tar.gz \
|
||||||
|
&& cd /usr/src/ruby \
|
||||||
|
&& autoconf \
|
||||||
|
&& ./configure --disable-install-doc \
|
||||||
|
&& make -j"$(nproc)" \
|
||||||
|
&& make install \
|
||||||
|
&& apt-get purge -y --auto-remove bison libgdbm-dev ruby \
|
||||||
|
&& gem update --system $RUBYGEMS_VERSION \
|
||||||
|
&& rm -r /usr/src/ruby
|
||||||
|
|
||||||
|
# install things globally, for great justice
|
||||||
|
ENV GEM_HOME /usr/local/bundle
|
||||||
|
ENV PATH $GEM_HOME/bin:$PATH
|
||||||
|
|
||||||
|
ENV BUNDLER_VERSION 1.10.6
|
||||||
|
|
||||||
|
RUN gem install bundler --version "$BUNDLER_VERSION" \
|
||||||
|
&& bundle config --global path "$GEM_HOME" \
|
||||||
|
&& bundle config --global bin "$GEM_HOME/bin"
|
||||||
|
|
||||||
|
# don't create ".bundle" in all our apps
|
||||||
|
ENV BUNDLE_APP_CONFIG $GEM_HOME
|
95
go-wrapper
Normal file
95
go-wrapper
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
base="$(basename "$0")"
|
||||||
|
cat <<EOUSAGE
|
||||||
|
|
||||||
|
usage: $base command [args]
|
||||||
|
|
||||||
|
This script assumes that is is run from the root of your Go package (for
|
||||||
|
example, "/go/src/app" if your GOPATH is set to "/go").
|
||||||
|
|
||||||
|
In Go 1.4, a feature was introduced to supply the canonical "import path" for a
|
||||||
|
given package in a comment attached to a package statement
|
||||||
|
(https://golang.org/s/go14customimport).
|
||||||
|
|
||||||
|
This script allows us to take a generic directory of Go source files such as
|
||||||
|
"/go/src/app" and determine that the canonical "import path" of where that code
|
||||||
|
expects to live and reference itself is "github.com/jsmith/my-cool-app". It
|
||||||
|
will then ensure that "/go/src/github.com/jsmith/my-cool-app" is a symlink to
|
||||||
|
"/go/src/app", which allows us to build and run it under the proper package
|
||||||
|
name.
|
||||||
|
|
||||||
|
For compatibility with versions of Go older than 1.4, the "import path" may also
|
||||||
|
be placed in a file named ".godir".
|
||||||
|
|
||||||
|
Available Commands:
|
||||||
|
|
||||||
|
$base download
|
||||||
|
$base download -u
|
||||||
|
(equivalent to "go get -d [args] [godir]")
|
||||||
|
|
||||||
|
$base install
|
||||||
|
$base install -race
|
||||||
|
(equivalent to "go install [args] [godir]")
|
||||||
|
|
||||||
|
$base run
|
||||||
|
$base run -app -specific -arguments
|
||||||
|
(assumes "GOPATH/bin" is in "PATH")
|
||||||
|
|
||||||
|
EOUSAGE
|
||||||
|
}
|
||||||
|
|
||||||
|
# "shift" so that "$@" becomes the remaining arguments and can be passed along to other "go" subcommands easily
|
||||||
|
cmd="$1"
|
||||||
|
if ! shift; then
|
||||||
|
usage >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
goDir="$(go list -e -f '{{.ImportComment}}' 2>/dev/null || true)"
|
||||||
|
|
||||||
|
if [ -z "$goDir" -a -s .godir ]; then
|
||||||
|
goDir="$(cat .godir)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dir="$(pwd -P)"
|
||||||
|
if [ "$goDir" ]; then
|
||||||
|
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)
|
||||||
|
goDirPath="$goPath/src/$goDir"
|
||||||
|
mkdir -p "$(dirname "$goDirPath")"
|
||||||
|
if [ ! -e "$goDirPath" ]; then
|
||||||
|
ln -sfv "$dir" "$goDirPath"
|
||||||
|
elif [ ! -L "$goDirPath" ]; then
|
||||||
|
echo >&2 "error: $goDirPath already exists but is unexpectedly not a symlink!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
goBin="$goPath/bin/$(basename "$goDir")"
|
||||||
|
else
|
||||||
|
goBin="$(basename "$dir")" # likely "app"
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$cmd" in
|
||||||
|
download)
|
||||||
|
execCommand=( go get -v -d "$@" )
|
||||||
|
if [ "$goDir" ]; then execCommand+=( "$goDir" ); fi
|
||||||
|
set -x; exec "${execCommand[@]}"
|
||||||
|
;;
|
||||||
|
|
||||||
|
install)
|
||||||
|
execCommand=( go install -v "$@" )
|
||||||
|
if [ "$goDir" ]; then execCommand+=( "$goDir" ); fi
|
||||||
|
set -x; exec "${execCommand[@]}"
|
||||||
|
;;
|
||||||
|
|
||||||
|
run)
|
||||||
|
set -x; exec "$goBin" "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo >&2 'error: unknown command:' "$cmd"
|
||||||
|
usage >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
Loading…
Reference in New Issue
Block a user