From 2b87d8a994a523216f2ef8b35edb8bcd9c4fc931 Mon Sep 17 00:00:00 2001 From: Maxim Babichev Date: Sat, 19 Aug 2023 08:59:25 +0300 Subject: [PATCH] Gripmock standalone --- Dockerfile | 16 ++++++++++++++-- Makefile | 2 ++ build.sh | 10 ---------- push.sh | 10 ---------- 4 files changed, 16 insertions(+), 22 deletions(-) create mode 100644 Makefile delete mode 100755 build.sh delete mode 100755 push.sh diff --git a/Dockerfile b/Dockerfile index 8651fa9..4d5445a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,6 @@ -FROM golang:1.21.0-alpine3.17 +ARG BUILD_ARG_GO_VERSION=1.21.0 +ARG BUILD_ARG_ALPINE_VERSION=3.18 +FROM golang:${BUILD_ARG_GO_VERSION}-alpine${BUILD_ARG_ALPINE_VERSION} AS builder # install tools (bash, git, protobuf, protoc-gen-go, protoc-grn-go-grpc, pkger) RUN apk -U --no-cache add bash git protobuf &&\ @@ -28,6 +30,16 @@ WORKDIR /go/src/github.com/tokopedia/gripmock # install gripmock & build example to cache necessary imports RUN go install -v && go build ./example/simple/client +RUN cp $GOPATH/bin/gripmock /usr/local/bin/ + +FROM alpine:${BUILD_ARG_ALPINE_VERSION} + +WORKDIR / + +RUN apk add --update protoc + +COPY --from=builder /usr/local/bin/gripmock . + EXPOSE 4770 4771 -ENTRYPOINT ["gripmock"] +ENTRYPOINT ["/gripmock"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d0924a8 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +build: + docker buildx build --load -t "rez1dent3/gripmock:latest" --no-cache --platform linux/arm64 . diff --git a/build.sh b/build.sh deleted file mode 100755 index f9f9fdf..0000000 --- a/build.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if [ "$1" = "" ]; then - echo "Version is empty" - exit 0 -fi - -go build ../. - -docker buildx build --load -t "tkpd/gripmock:$1" --platform linux/amd64 . diff --git a/push.sh b/push.sh deleted file mode 100755 index 80e360e..0000000 --- a/push.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if [ "$1" = "" ]; then - echo "Version is empty" - exit 0 -fi - -go build ../. - -docker buildx build --push -t "tkpd/gripmock:$1" --platform linux/amd64,linux/arm64 .