-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (49 loc) · 2.01 KB
/
Makefile
File metadata and controls
70 lines (49 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
CURRENT_DIR=$(shell pwd)
APP=$(shell basename ${CURRENT_DIR})
APP_CMD_DIR=${CURRENT_DIR}/cmd
IMG_NAME=${APP}
REGISTRY=${REGISTRY}
TAG=latest
ENV_TAG=latest
NETWORK_NAME=ur_default
PROJECT_NAME=urecruit
# Including
include .build_info
run:
docker-compose -f docker-compose.yml up --force-recreate
test:
docker-compose -f docker-compose.test.yml up --force-recreate
config:
docker-compose -f docker-compose.yml config
build:
CGO_ENABLED=0 GOOS=linux go build -mod=vendor -a -installsuffix cgo -o ${CURRENT_DIR}/bin/${APP} ${APP_CMD_DIR}/main.go
proto-gen:
./scripts/gen-proto.sh ${CURRENT_DIR}
clone-protos:
rm -rf protos/* && cp -R ur_protos/* protos
pull-proto-module:
git submodule update --init --recursive
update-proto-module:
git submodule update --remote --merge
clear:
rm -rf ${CURRENT_DIR}/bin/*
network:
docker network create --driver=bridge ${NETWORK_NAME}
migrate-up:
docker run --mount type=bind,source="${CURRENT_DIR}/migrations,target=/migrations" --network ${NETWORK_NAME} migrate/migrate \
-path=/migrations/ -database=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?sslmode=disable up
migrate-down:
docker run --mount type=bind,source="${CURRENT_DIR}/migrations,target=/migrations" --network ${NETWORK_NAME} migrate/migrate \
-path=/migrations/ -database=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?sslmode=disable down
mark-as-production-image:
docker tag ${REGISTRY}/${PROJECT_NAME}/${APP}/${IMG_NAME}:${TAG} ${REGISTRY}/${PROJECT_NAME}/${APP}/${IMG_NAME}:production
docker push ${REGISTRY}/${PROJECT_NAME}/${APP}/${IMG_NAME}:production
build-image:
@docker build --rm -t ${REGISTRY}/${PROJECT_NAME}/${APP}:${TAG} .
@docker tag ${REGISTRY}/${PROJECT_NAME}/${APP}:${TAG} ${REGISTRY}/${PROJECT_NAME}/${APP}:${ENV_TAG}
push-image:
@docker push ${REGISTRY}/${PROJECT_NAME}/${APP}:${TAG}
@docker push ${REGISTRY}/${PROJECT_NAME}/${APP}:${ENV_TAG}
swag-init:
swag init -g api/main.go
.PHONY: proto