Commit dc195184 authored by Svetomir Smiljkovic's avatar Svetomir Smiljkovic Committed by Janoš Guljaš

Update Dockerfile and Makefile (#2)

parent 45f7bdfa
.dockerignore
.DS_Store
.git
.gitignore
.github
.idea
.vscode
dist
Dockerfile
*.yaml
*.yml
*.md
FROM golang AS builder FROM golang:1.13 AS build
ADD . /src
ARG COMMIT=""
WORKDIR /src WORKDIR /src
RUN make binary COPY . ./
FROM debian RUN make binary COMMIT=$COMMIT
RUN apt update && apt install -y \
ca-certificates \ FROM debian:10.2-slim
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /src/dist/bee /usr/local/bin/bee ENV DEBIAN_FRONTEND noninteractive
RUN chmod +x /usr/local/bin/bee
RUN apt-get update && apt-get install -y \
ca-certificates && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \
groupadd -r drone && \
useradd --no-log-init -r -g drone drone
COPY --from=build /src/dist/bee /usr/local/bin/bee
USER drone
ENTRYPOINT ["bee"] ENTRYPOINT ["bee"]
COMMIT ?= ""
GO ?= go GO ?= go
GOLANGCI_LINT ?= golangci-lint GOLANGCI_LINT ?= golangci-lint
LDFLAGS ?= -s -w -X github.com/janos/bee.commit="$(shell git describe --long --dirty --always --match "" || true)" LDFLAGS ?= -s -w -X github.com/janos/bee.commit="$(COMMIT)"
.PHONY: all .PHONY: all
all: lint vet test binary all: lint vet test binary
...@@ -32,4 +34,9 @@ build: export CGO_ENABLED=0 ...@@ -32,4 +34,9 @@ build: export CGO_ENABLED=0
build: build:
$(GO) build -trimpath -ldflags "$(LDFLAGS)" ./... $(GO) build -trimpath -ldflags "$(LDFLAGS)" ./...
.PHONY: clean
clean:
$(GO) clean
rm -rf dist/
FORCE: FORCE:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment