Skip to content

Commit

Permalink
Adds a Dockerfile
Browse files Browse the repository at this point in the history
go dependencies in alpine

Signed-off-by: Patrick Rachford <64233065+rachfop@users.noreply.github.com>
  • Loading branch information
rachfop committed Dec 14, 2022
1 parent fac1994 commit 1cfd3f7
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Use the official 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.19 as builder

# https://stackoverflow.com/questions/36279253/go-compiled-binary-wont-run-in-an-alpine-docker-container-on-ubuntu-host
ENV CGO_ENABLED=0

# Set the current working directory inside the container.
WORKDIR /go/src/github.com/score-spec/score-helm

# Copy the entire project and build it.
COPY . .
RUN GOOS=linux GOARCH=amd64 go build -o /usr/local/bin/score-helm ./cmd/score-helm

# Use the official Alpine image for a lean production container.
# https://hub.docker.com/_/alpine
# https://docs.docker.com/develop/develop-images/multistage-build/#use-multi-stage-builds
FROM alpine:3

# Set the current working directory inside the container.
WORKDIR /score-helm

# Copy the binary from the builder image.
COPY --from=builder /usr/local/bin/score-helm /usr/local/bin/score-helm

# Run the binary.
ENTRYPOINT ["/usr/local/bin/score-helm"]

0 comments on commit 1cfd3f7

Please sign in to comment.