-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
29 lines (24 loc) · 900 Bytes
/
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
###############################
# STEP 1 build the application
###############################
ARG GO_VERSION=0
ARG ALPINE_VERSION=0
ARG BASE_IMAGE_VERSION=0
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS builder
RUN apk add --no-cache bash git upx
RUN mkdir -p /acceldata/src/gurl /acceldata/bin
COPY . /acceldata/src/gurl
ENV GOPATH=/acceldata
WORKDIR /acceldata/src/gurl
RUN go mod vendor && \
\
env CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=vendor -a -installsuffix cgo -gcflags=all='-l -B' -ldflags '-s -w' -o /acceldata/bin/gurl && \
\
upx -9 -k /acceldata/bin/gurl
#############################################
# STEP 2 copy gurl binary to the base image
#############################################
# Use OpenJRE KRB5 Base Image
FROM alpine:${BASE_IMAGE_VERSION}
# Copy gurl static executable binary
COPY --from=builder /acceldata/bin/gurl /usr/bin/gurl