Revert "chore: add build target to Makefile & builder to Dockerfile" (#218)

* Revert "chore: add build target to Makefile & builder to Dockerfile (#215)"

This reverts commit de88bc221a.

* fix: generate image from current commit

goreleaser was using the latest commit to master instead of the PR.

* chore: getting goreleaser to play nice
This commit is contained in:
Enrico Stahn 2022-03-30 22:24:40 +11:00 committed by GitHub
parent f29acfe056
commit 7004aa2d93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 25 deletions

View file

@ -1,29 +1,10 @@
# Build the binary FROM alpine:3.15.0
FROM docker.io/library/golang:1.18 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the go source
COPY main.go main.go
COPY cmd/ cmd/
COPY phpfpm/ phpfpm/
# Build
RUN CGO_ENABLED=0 go build -a -o php-fpm_exporter main.go
FROM docker.io/library/alpine:3.15.0
ARG BUILD_DATE ARG BUILD_DATE
ARG VCS_REF ARG VCS_REF
ARG VERSION ARG VERSION
COPY --from=builder /workspace/php-fpm_exporter . COPY php-fpm_exporter /
EXPOSE 9253 EXPOSE 9253
ENTRYPOINT [ "/php-fpm_exporter", "server" ] ENTRYPOINT [ "/php-fpm_exporter", "server" ]

View file

@ -7,9 +7,6 @@ help: ## List targets & descriptions
deps: ## Get dependencies deps: ## Get dependencies
go get -d -v ./... go get -d -v ./...
build: deps ## Build the binary
go build -a -o php-fpm_exporter main.go
test: ## Run tests test: ## Run tests
go test -short ./... go test -short ./...
@ -29,4 +26,4 @@ lint: ## Run linters
golangci-lint run golangci-lint run
fmt: ## Fix formatting issues fmt: ## Fix formatting issues
goimports -w . goimports -w .