This repository has been archived on 2024-04-25. You can view files and clone it, but cannot push or open issues or pull requests.
golang-rest-example/justfile

34 lines
643 B
Makefile
Raw Normal View History

2024-02-01 22:09:09 +00:00
export GO_VERSION := "1.21"
_default:
@just --list
# Run the app in development mode
2024-02-01 18:57:25 +00:00
run:
2024-02-02 14:39:13 +00:00
docker compose up --build app swagger
delete:
docker compose down
2024-02-01 18:57:25 +00:00
2024-02-01 22:09:09 +00:00
# Generate OpenAPI files
2024-02-01 18:57:25 +00:00
gen:
2024-02-02 14:39:13 +00:00
docker compose run --build --rm app \
2024-02-01 22:09:09 +00:00
go generate ./...
2024-02-02 14:39:13 +00:00
# Create a new migration file
migration-create name:
@docker compose run --build --rm app \
migrate create -ext sql -dir migrations -seq {{name}}
2024-02-01 22:09:09 +00:00
# Build production image
build:
docker build \
--build-arg GO_VERSION=$(GO_VERSION) \
-t golang-rest-example \
.
2024-02-02 14:39:13 +00:00
# Run pgcli to connect to the database
db-cli:
docker compose exec db psql -U postgres -d postgres