Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #46 from keptn-contrib/patch/dockerfile
Browse files Browse the repository at this point in the history
updated Dockerfile to enable Dynatrace monitoring
  • Loading branch information
bacherfl authored Mar 6, 2020
2 parents e2544fd + 210b696 commit 7cc868b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
17 changes: 7 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
# Use the offical Golang image to create a build artifact.
# This is based on Debian and sets the GOPATH to /go.
# https://hub.docker.com/_/golang
FROM golang:1.12 as builder
FROM golang:1.12.13-alpine as builder

WORKDIR /go/src/github.com/keptn-contrib/servicenow-service

ENV GO111MODULE=on
ENV GOPROXY=https://proxy.golang.org
ENV BUILDFLAGS=""

RUN apk add --no-cache gcc libc-dev git

# Copy `go.mod` for definitions and `go.sum` to invalidate the next layer
# in case of a change in the dependencies
COPY go.mod go.sum ./
Expand All @@ -27,17 +29,12 @@ COPY . .

# Build the command inside the container.
# (You may fetch or manage dependencies here, either manually or with a tool like "godep".)
RUN CGO_ENABLED=0 GOOS=linux go build $BUILDFLAGS -v -o servicenow-service ./cmd/
RUN GOOS=linux go build -ldflags '-linkmode=external' $BUILDFLAGS -v -o servicenow-service ./cmd/

# Use a Docker multi-stage build to create a lean production image.
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM alpine:3.7
RUN apk add --no-cache ca-certificates

ARG debugBuild

# IF we are debugging, we need to install libc6-compat for delve to work on alpine based containers
RUN if [ ! -z "$debugBuild" ]; then apk add --no-cache libc6-compat; fi
FROM alpine:3.11
RUN apk add --no-cache ca-certificates libc6-compat

# Copy the binary to the production image from the builder stage.
COPY --from=builder /go/src/github.com/keptn-contrib/servicenow-service/servicenow-service /servicenow-service
Expand All @@ -52,4 +49,4 @@ ENV GOTRACEBACK=all
#travis-uncomment COPY entrypoint.sh /
#travis-uncomment ENTRYPOINT ["/entrypoint.sh"]

CMD ["/servicenow-service"]
CMD ["/servicenow-service"]
13 changes: 13 additions & 0 deletions skaffold.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: skaffold/v1beta13
kind: Config
build:
artifacts:
- image: keptncontrib/servicenow-service
docker: # beta describes an artifact built from a Dockerfile.
dockerfile: Dockerfile
buildArgs:
debugBuild: true
deploy:
kubectl:
manifests:
- deploy/service.yaml

0 comments on commit 7cc868b

Please sign in to comment.