-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (40 loc) · 2.07 KB
/
Makefile
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
down:
docker compose down --remove-orphans
up:
docker compose up --build -d
test:
go test -v ./...
check:
golangci-lint run -v
check-fix:
golangci-lint run --fix
dev-rebuild: down dev-docker-build up
dev-docker-build:
REGISTRY=localhost IMAGE_TAG=main-1 make docker-build
docker-build:
DOCKER_BUILDKIT=1 docker --log-level=debug build --pull --build-arg BUILDKIT_INLINE_CACHE=1 \
--target builder \
--cache-from ${REGISTRY}/tg-svodd-bot:cache-builder \
--tag ${REGISTRY}/tg-svodd-bot:cache-builder \
--file ./Dockerfile .
DOCKER_BUILDKIT=1 docker --log-level=debug build --pull --build-arg BUILDKIT_INLINE_CACHE=1 \
--cache-from ${REGISTRY}/tg-svodd-bot:cache-builder \
--cache-from ${REGISTRY}/tg-svodd-bot:cache \
--tag ${REGISTRY}/tg-svodd-bot:cache \
--tag ${REGISTRY}/tg-svodd-bot:${IMAGE_TAG} \
--file ./Dockerfile .
push-build-cache:
docker push ${REGISTRY}/tg-svodd-bot:cache-builder
docker push ${REGISTRY}/tg-svodd-bot:cache
push:
docker push ${REGISTRY}/tg-svodd-bot:${IMAGE_TAG}
deploy:
ssh -o StrictHostKeyChecking=no deploy@${HOST} -p ${PORT} 'docker network create --driver=overlay traefik-public || true'
ssh -o StrictHostKeyChecking=no deploy@${HOST} -p ${PORT} 'docker network create --driver=overlay svodd-network || true'
ssh -o StrictHostKeyChecking=no deploy@${HOST} -p ${PORT} 'rm -rf tg-svodd-bot_${BUILD_NUMBER} && mkdir tg-svodd-bot_${BUILD_NUMBER}'
envsubst < docker-compose-production.yml > docker-compose-production-env.yml
scp -o StrictHostKeyChecking=no -P ${PORT} docker-compose-production-env.yml deploy@${HOST}:tg-svodd-bot_${BUILD_NUMBER}/docker-compose.yml
rm -f docker-compose-production-env.yml
ssh -o StrictHostKeyChecking=no deploy@${HOST} -p ${PORT} 'mkdir tg-svodd-bot_${BUILD_NUMBER}/secrets'
ssh -o StrictHostKeyChecking=no deploy@${HOST} -p ${PORT} 'cp .secrets_tg_svodd_bot/* tg-svodd-bot_${BUILD_NUMBER}/secrets'
ssh -o StrictHostKeyChecking=no deploy@${HOST} -p ${PORT} 'cd tg-svodd-bot_${BUILD_NUMBER} && docker stack deploy --compose-file docker-compose.yml tg-svodd-bot --with-registry-auth --prune'