Skip to content

Commit

Permalink
prepare docker image for quay, pushing via goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
mskarbe committed Jun 26, 2020
1 parent d06b885 commit 0f548b5
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,34 @@ checksum:

snapshot:
name_template: "{{ .Tag }}-snapshot"

# to push to quay
dockers:
-
# GOOS of the built binary that should be used.
goos: linux

# GOARCH of the built binary that should be used.
goarch: amd64

# Name templates of the built binaries that should be used.
binaries:
- gman

# Templates of the Docker image names.
image_templates:
- "quay.io/kubermatic-labs/gman:{{ .Tag }}"

# Skips the docker push. Could be useful if you also do draft releases.
skip_push: false

# Path to the Dockerfile (from the project root).
dockerfile: Dockerfile

# If your Dockerfile copies files other than the binary itself,
# you should list them here as well.
# the paths here are relative to the folder in which goreleaser is being run.
#extra_files:
#- README.md
#- LICENSE
#- config.example.yaml
29 changes: 29 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
FROM golang:alpine AS builder
RUN apk add git
# necessary environmet variables
ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64

WORKDIR /build
COPY go.mod .
COPY go.sum .
RUN go mod download

# Copy the code into the container & build
COPY main.go .
RUN go build -o gman main.go

WORKDIR /app

# Copy binary from build to main folder
RUN cp /build/gman .

# Build a small image
FROM scratch

COPY --from=builder /app/gman /

# Command to run
ENTRYPOINT ["/gman"]

0 comments on commit 0f548b5

Please sign in to comment.