-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
47 lines (33 loc) · 1.16 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# data-crunch-engine Dockerfile used to build docker image
# Multi-stage build to create a small docker image
#################################
# STAGE 1 build executable binary
#################################
FROM golang:alpine AS builder
# Install git
# Git is required for fetching the dependencies
RUN apk update && apk add --no-cache git
# SET WORKING DIRECTORY AND PLACE YOUR CODE IN
WORKDIR $GOPATH/src/github.com/jeffdecola/data-crunch-engine/
COPY . .
# CHECK
RUN ls -lat $GOPATH/src/github.com/jeffdecola/data-crunch-engine/
# Fetch dependencies using go get
RUN go get -u github.com/sirupsen/logrus
RUN go get -d -v
# Build the binary
RUN go build -o /go/bin/data-crunch-engine main.go
###############################
# STAGE 2 build a smaller image
###############################
FROM alpine
# Add my name to it
LABEL maintainer="Jeff DeCola https://github.com/JeffDeCola/data-crunch-engine"
# Put the binary from previous build into /app
RUN mkdir /app
COPY --from=builder /go/bin/data-crunch-engine /app/data-crunch-engine
WORKDIR /app
# Add the ailibty to /bin/bash in alpine
RUN apk add --update bash
# Run the binary
ENTRYPOINT ["/app/data-crunch-engine"]