Skip to content

Commit 47d2224

Browse files
author
Nilesh Simaria
committed
quick docker build
1 parent 4b02575 commit 47d2224

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

Dockerfile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
# Copyright (c) 2018, Juniper Networks, Inc.
22
# All rights reserved.
33

4-
FROM alpine:3.7
5-
RUN apk add --no-cache ethtool
6-
RUN apk add --no-cache --virtual build-dependencies git go musl-dev \
7-
&& mkdir -p /root/go/src/github.com/nileshsimaria \
8-
&& cd /root/go/src/github.com/nileshsimaria \
9-
&& git clone https://github.com/nileshsimaria/jtimon.git \
10-
&& cd jtimon && go build && strip jtimon && mv jtimon /usr/local/bin \
11-
&& cd / \
12-
&& rm -fr /root/go \
13-
&& apk del build-dependencies
4+
FROM golang:1.13.4-alpine3.10
5+
ARG COMMIT
6+
ARG BRANCH
7+
ARG TIME
8+
9+
WORKDIR /go/src/app
10+
COPY . .
11+
12+
RUN GO111MODULE=on go build -mod vendor \
13+
--ldflags="-X main.jtimonVersion=${COMMIT}-${BRANCH} -X main.buildTime=${TIME}" \
14+
-o /usr/local/bin/jtimon
1415

1516
VOLUME /u
1617
WORKDIR /u

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ darwin: ## generate a osx version of the binary
2929
GOOS=darwin GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-darwin-${GOARCH} .
3030

3131
docker: ## build a docker image that can be used to execute the binary
32-
docker build -t jtimon .
32+
docker build --build-arg COMMIT=${COMMIT} --build-arg BRANCH=${BRANCH} --build-arg TIME=${TIME} -t jtimon .
3333
ln -sf launch-docker-container.sh jtimon
3434
@echo "Usage: docker run -ti --rm jtimon --help"
3535
@echo "or simply call the shell script './jtimon --help"

0 commit comments

Comments
 (0)