-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Daiki Muroga
authored and
Daiki Muroga
committed
May 29, 2022
1 parent
8a157a6
commit 82a0e48
Showing
7 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# env file | ||
.env | ||
|
||
# tmp directory | ||
tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM golang:1.18-alpine3.15 | ||
|
||
WORKDIR /app/go/base | ||
|
||
RUN apk add --no-cache --update-cache \ | ||
alpine-sdk \ | ||
protoc | ||
|
||
RUN go install github.com/cosmtrek/air@latest && \ | ||
go install github.com/golang/protobuf/protoc-gen-go@latest && \ | ||
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest && \ | ||
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest && \ | ||
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest | ||
|
||
COPY . . | ||
|
||
#RUN go mod tidy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.PHONY: docker-up | ||
docker-up: | ||
@docker-compose -f docker-compose.local.yml up -d | ||
|
||
.PHONY: docker-down | ||
docker-down: | ||
@docker-compose -f docker-compose.local.yml down | ||
|
||
.PHONY: docker-stop | ||
docker-stop: | ||
@docker-compose -f docker-compose.local.yml stop | ||
|
||
.PHONY: docker-build | ||
docker-build: | ||
@docker-compose -f docker-compose.local.yml build | ||
|
||
.PHONY: watch-log | ||
watch-log: | ||
@docker-compose -f docker-compose.local.yml logs -f blockchain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# blockchain server | ||
Provide a blockchain server. | ||
|
||
## Version | ||
- Docker:20.10.12 | ||
- golang:1.18 | ||
|
||
## Commands | ||
### Run local | ||
- `set .env file` | ||
- `make docker-up` | ||
|
||
### Build local | ||
- `make docker-build` | ||
|
||
### Watch log local | ||
- `make watch-log` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Config file for [Air](https://github.com/cosmtrek/air) in TOML format | ||
|
||
# Working directory | ||
# . or absolute path, please note that the directories following must be under root. | ||
root = "." | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
# Just plain old shell command. You could use `make` as well. | ||
cmd = "go build -o /tmp/main ./cmd/main.go" | ||
# Binary file yields from `cmd`. | ||
bin = "/tmp/main" | ||
# Customize binary. | ||
full_bin = "SERVER_ENV=local APP_USER=air /tmp/main" | ||
# Watch these filename extensions. | ||
include_ext = ["go", "tpl", "tmpl"] | ||
# Ignore these filename extensions or directories. | ||
exclude_dir = ["assets", "tmp", "vendor"] | ||
# Watch these directories if you specified. | ||
include_dir = [] | ||
# Exclude files. | ||
exclude_file = [] | ||
# This log file places in your tmp_dir. | ||
log = "air.log" | ||
# It's not necessary to trigger build each time file changes if it's too frequent. | ||
delay = 1000 # ms | ||
# Stop running old binary when build errors occur. | ||
stop_on_error = true | ||
# Send Interrupt signal before killing process (windows does not support this feature) | ||
send_interrupt = false | ||
# Delay after sending Interrupt signal | ||
kill_delay = 500 # ms | ||
|
||
[log] | ||
# Show log time | ||
time = false | ||
|
||
[color] | ||
# Customize each part's color. If no color found, use the raw app log. | ||
main = "magenta" | ||
watcher = "cyan" | ||
build = "yellow" | ||
runner = "green" | ||
|
||
[misc] | ||
# Delete tmp directory on exit | ||
clean_on_exit = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
func main() { | ||
fmt.Println("hello") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
version: "3" | ||
|
||
services: | ||
blockchain: | ||
container_name: blockchain-server | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.local | ||
command: "air -c /app/go/base/cmd/.air.toml" | ||
env_file: | ||
- .env | ||
image: blockchain | ||
volumes: | ||
- .:/app/go/base:rw | ||
tty: true | ||
ports: | ||
- ${REST_PORT}:${REST_PORT} | ||
- ${GRPC_PORT}:${GRPC_PORT} |