Skip to content

Commit

Permalink
add dockerfile (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazegusuri authored Mar 12, 2023
1 parent d04d088 commit a76223c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM golang:1.18 as build

ARG VERSION

WORKDIR /go/src/app
COPY . .

RUN go mod download
RUN CGO_ENABLED=0 go build \
-ldflags "-s -w -X github.com/cloudspannerecosystem/wrench/cmd.version=${VERSION}" \
-o /go/bin/app/wrench

FROM gcr.io/distroless/static-debian11
COPY --from=build /go/bin/app/wrench /
ENTRYPOINT ["/wrench"]
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ SPANNER_EMULATOR_HOST_REST := localhost:9020
export SPANNER_PROJECT_ID ?= wrench-test-project
export SPANNER_INSTANCE_ID ?= wrench-test-instance

REGISTRY := mercari/wrench

.PHONY: test
test:
go test -race -v ./...
Expand All @@ -21,3 +23,6 @@ build:

setup-emulator:
curl -s "${SPANNER_EMULATOR_HOST_REST}/v1/projects/${SPANNER_PROJECT_ID}/instances" --data '{"instanceId": "'${SPANNER_INSTANCE_ID}'"}'

docker-build:
docker build . -t $(REGISTRY):$(VERSION) --build-arg VERSION=$(VERSION)

0 comments on commit a76223c

Please sign in to comment.