-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathDockerfile
More file actions
34 lines (23 loc) · 765 Bytes
/
Dockerfile
File metadata and controls
34 lines (23 loc) · 765 Bytes
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
FROM golang:1.13.7-alpine3.11 as build-env
ARG git_user
ARG git_key
# Copy the source from the current directory to the Working Directory inside the container
WORKDIR /app
ENV GOPRIVATE=github.com/checkmarxDev/*
RUN apk add --no-cache git \
&& git config \
--global \
url."https://${GIT_USER}:${GIT_TOKEN}@github.com".insteadOf \
"https://github.com"
#Copy go mod and sum files
COPY go.mod .
COPY go.sum .
# Get dependancies - will also be cached if we won't change mod/sum
RUN go mod download
# COPY the source code as the last step
COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -o bin/ast cmd/main.go
#runtime image
FROM scratch
COPY --from=build-env /app/bin/ast /app/bin/ast
ENTRYPOINT ["/app/bin/ast-cli"]