-
Notifications
You must be signed in to change notification settings - Fork 7
/
Dockerfile
33 lines (28 loc) · 1.12 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
FROM rawmind/alpine-tools:3.8-0
MAINTAINER Raul Sanchez <[email protected]>
ENV SERVICE_ARCHIVE=/opt/rancher-tools.tgz \
GOMAXPROCS=2 \
GOROOT=/usr/lib/go \
GOPATH=/opt/src \
GOBIN=/gopath/bin \
RANCHER_TEMPLATE_VERSION=0.3-2 \
RANCHER_TEMPLATE_REPO=https://github.com/rawmind0/rancher-template.git
# Add files
ADD root /
RUN apk add --no-cache go git musl-dev && \
mkdir -p /opt/src \
${SERVICE_VOLUME}/rancher-template/etc \
${SERVICE_VOLUME}/rancher-template/bin \
${SERVICE_VOLUME}/rancher-template/log \
${SERVICE_VOLUME}/rancher-template/tmpl && \
cd /opt/src && \
git clone -b ${RANCHER_TEMPLATE_VERSION} ${RANCHER_TEMPLATE_REPO} && \
cd rancher-template && \
go get && \
CGO_ENABLED=0 GOOS=linux go build -a -ldflags '-extldflags "-static"' -o rancher-template && \
mv rancher-template ${SERVICE_VOLUME}/rancher-template/bin/ && \
chmod 755 ${SERVICE_VOLUME}/rancher-template/bin/* && \
cd ${SERVICE_VOLUME} && \
tar czvf ${SERVICE_ARCHIVE} * && \
apk del go git musl-dev && \
rm -rf /var/cache/apk/* /opt/src ${SERVICE_VOLUME}/*