Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
Adds Dockerfile (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
rachfop committed Jan 23, 2023
2 parents cc9f731 + 348ab23 commit a1fc89e
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-humanitec

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

# 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-humanitec

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

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

0 comments on commit a1fc89e

Please sign in to comment.