Skip to content

Commit

Permalink
update gitignore and add cmd api
Browse files Browse the repository at this point in the history
  • Loading branch information
tsw303005 committed May 10, 2022
1 parent 32161be commit d336699
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM gcr.io/distroless/base-debian11 AS base

COPY bin/app/cmd /cmd

CMD ["/cmd"]
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,17 @@ bin/protoc-gen-go-grpc: go.mod

bin/protoc-gen-grpc-gateway: go.mod
go build -o $@ github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway


# build
.PHONY: dc.image
dc.image: dc.build
$(DOCKER_COMPOSE) build --force-rm image

.PHONY: dc.build
dc.build:
$(DOCKER_COMPOSE) run --rm build

build:
mkdir -p ./bin/app
go build -o ./bin/app/cmd ./cmd/main.go
Binary file added bin/app/cmd
Binary file not shown.
18 changes: 18 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,21 @@ services:
command:
- make
- lint

build:
<<: *common-build
command:
- make
- build

api:
image: tsw303005/blog-server:latest
environment:
<<: *common-env
API_SEVER_ADDR: api:8081
command:
- /cmd
- api
- api
depends_on:
- mongo

0 comments on commit d336699

Please sign in to comment.