Trying to implement follow The Twelve Factor App
.
Dockerfile
LICENSE
Makefile
README.md
cmd
othercmd # example other command line app
server # start reading code from here
internal
api/v1
config
| |-- dto
entities
| |-- errors
| |-- log
services
utils
config
default.yaml
docs
dist
drawin
linux
windows
docker-compose.yml
go.mod
go.sum
macOS
# install dep to build binary for linux and windows
brew install FiloSottile/musl-cross/musl-cross
brew install mingw-w64
Command Line
Run project with docker compose
docker compose -f dev.yml up --build
Run project without build
go run ./cmd/server [command] --[flag-name]=[flag-value]
Generate API Document
make doc
# open url http://localhost:5000/doc/index.html
Build using make
command
# Build single binary with specify os
make build[-mac|win|linux]
# Build all os
make all
# Running test
make test
# Start server without build binary file
make run
Build with docker
docker compose build # build docker image
docker compose up # run on docker
# or
docker compose up --build # build and run
docker push [image-name] # public docker image to registry
Viper uses the following precedence order. Each item takes precedence over the item below it: