Skip to content

Commit

Permalink
feat: enable makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
wusphinx committed Nov 15, 2023
1 parent 4543cf9 commit 3346656
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# syntax=docker/dockerfile:1.4
FROM golang:1.20.5-bullseye AS build

WORKDIR /opt

COPY go.mod .
COPY go.sum .

COPY main.go .

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod go build -o app

FROM busybox:1.35.0-glibc

WORKDIR /

COPY --from=build /opt /

EXPOSE 53
EXPOSE 2379

ENTRYPOINT ["/app"]
14 changes: 14 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.PHONY: lint
lint:
golangci-lint run -v

build:
go build

COMMIT_ID := $(shell git rev-parse --short HEAD)

img_repo ?= local

.PHONY: docker
docker:
docker build -t $(img_repo):$(COMMIT_ID) .
2 changes: 2 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ func TestARecord(t *testing.T) {

_, err = cli.Put(ctx, key, val)
assert.Nil(t, err)

// nolint
defer cli.Delete(ctx, key)

r := &net.Resolver{
Expand Down

0 comments on commit 3346656

Please sign in to comment.