Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
qorus
prometheus
Commits
c8a092eb
Commit
c8a092eb
authored
Sep 18, 2015
by
Fabian Reinartz
Browse files
Add goenv script and fix Docker
parent
ad644740
Changes
3
Hide whitespace changes
Inline
Side-by-side
Dockerfile
View file @
c8a092eb
FROM
sdurrheimer/alpine-glibc
MAINTAINER
The Prometheus Authors <prometheus-developers@googlegroups.com>
WORKDIR
/
app
COPY
. /
app
WORKDIR
/
gopath/src/github.com/prometheus/prometheus
COPY
. /
gopath/src/github.com/prometheus/prometheus
RUN
apk add
--update
-t
build-deps git make bash go
\
RUN
apk add
--update
-t
build-deps
tar
openssl git make bash
\
&&
source
./scripts/goenv.sh /go /gopath
\
&&
make build
\
&&
cp
prometheus promtool /bin/
\
&&
mkdir
-p
/etc/prometheus
\
&&
mv
./documentation/examples/prometheus.yml /etc/prometheus/prometheus.yml
\
&&
mv
./console_libraries/ ./consoles/ /etc/prometheus/
\
&&
apk del
--purge
build-deps
\
&&
rm
-rf
/
app
/var/cache/apk/
*
&&
rm
-rf
/
go /gopath
/var/cache/apk/
*
EXPOSE
9090
VOLUME
[ "/prometheus" ]
...
...
README.md
View file @
c8a092eb
...
...
@@ -36,7 +36,7 @@ Debian and RPM packages are being worked on.
### Building from source
To build Prometheus from the source code yourself you need to have a working
g
o environment with
[
version 1.5 or greater installed
](
http://golang.org/doc/install
)
.
G
o environment with
[
version 1.5 or greater installed
](
http://golang.org/doc/install
)
.
You can directly use the
`go`
tool to download and install the
`prometheus`
and
`promtool`
binaries into your
`GOPATH`
:
...
...
@@ -53,7 +53,7 @@ You can also clone the repository yourself and build using `make`:
$ make
$ ./prometheus -config.file=your_config.yml
The
m
akefile provides several targets:
The
M
akefile provides several targets:
*
*build*
: build the
`prometheus`
and
`promtool`
binaries
*
*test*
: run the tests
...
...
scripts/goenv.sh
0 → 100755
View file @
c8a092eb
# Copyright 2015 The Prometheus Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
goroot
=
"
$1
"
gopath
=
"
$2
"
go_version_min
=
"1.5"
go_version_install
=
"1.5.1"
vernum
()
{
printf
"%03d%03d%03d"
$(
echo
"
$1
"
|
tr
'.'
' '
)
}
if
command
-v
"go"
>
/dev/null
;
then
go_version
=
$(
go version |
sed
-e
's/^[^0-9.]*\([0-9.]*\).*/\1/'
)
fi
# If we satisfy the version requirement, there is nothing to do. Otherwise
# proceed downloading and installing a go environment.
if
[
$(
vernum
${
go_version
}
)
-ge
$(
vernum
${
go_version_min
}
)
]
;
then
return
fi
export
GOPATH
=
"
${
gopath
}
"
export
GOROOT
=
"
${
goroot
}
/
${
go_version_install
}
"
export
PATH
=
"
$PATH
:
$GOROOT
/bin"
if
[
!
-x
"
${
GOROOT
}
/bin/go"
]
;
then
mkdir
-p
"
${
GOROOT
}
"
os
=
$(
uname
|
tr
A-Z a-z
)
arch
=
$(
uname
-m
|
sed
-e
's/x86_64/amd64/'
|
sed
-e
's/i.86/386/'
)
url
=
"https://golang.org/dl"
tarball
=
"go
${
go_version_install
}
.
${
os
}
-
${
arch
}
.tar.gz"
wget
-qO-
"
${
url
}
/
${
tarball
}
"
|
tar
-C
"
${
GOROOT
}
"
--strip
1
-xz
fi
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment