-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (74 loc) · 3.59 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
all: dev
PORT=${PORT:-3001}
dev:
@foreman start -f Procfile.dev -p ${PORT}
build:
$(eval PL_COMMIT=$(shell git --git-dir=./.git rev-parse --short HEAD))
# COMMIT=${LK_COMMIT} docker-compose build layerkeep
docker build -t registry.digitalocean.com/frenzylabs/pluck:${PL_COMMIT} .
push:
$(eval PL_COMMIT=$(shell git --git-dir=./.git rev-parse --short HEAD))
docker push registry.digitalocean.com/frenzylabs/pluck:${PL_COMMIT}
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(RUN_ARGS):;@:)
release:
echo ${RUN_ARGS}
yarn version --${RUN_ARGS}
git push origin --follow-tags
prune-tags:
git tag -l | xargs git tag -d && git fetch -t
# 5c5fb76psr7v7w8s84qgvnlg
# docker run --rm \
# -v ${PWD}/.cache/vendor/bundle:/var/www/pluck/bundlecache \
# -v ${PWD}/.cache/public:/var/www/pluck/publiccache \
# ${ASSET_IMAGE} /bin/sh -c "cp -rf vendor/bundle/* bundlecache/ && cp -rf public/* publiccache/"
# docker run --rm \
# -v ${PWD}/../cache/yarn_cache:/var/www/pluck/nodecache \
# ${ASSET_IMAGE} /bin/sh -c 'CACHE_DIR=$$(yarn cache dir) && cp -rf $${CACHE_DIR} nodecache/'
buildassets:
$(eval IMAGE=localhost/pluck:test10)
$(eval ASSET_IMAGE=localhost/assets:latest)
DOCKER_BUILDKIT=1 docker build -f Dockerfile.app --cache-from localhost/assets:latest -t localhost/assets:latest --target assets .
# DOCKER_BUILDKIT=1 docker build -f Dockerfile.app --cache-from localhost/assets:latest --build-arg BUILDKIT_INLINE_CACHE=1 -t localhost/assets:latest --target assets .
buildfinal:
$(eval IMAGE=localhost/pluck:test10)
DOCKER_BUILDKIT=1 docker build -f Dockerfile.app --cache-from localhost/assets:latest -t ${IMAGE} --target final .
run:
$(eval KUBECONFIG=${PWD}/../layerkeep-infra/staging)
$(eval ELASTIC_PWD=cfxrt6lf8fk7vj9m66946hcd)
$(eval IMAGE=registry.digitalocean.com/frenzylabs/pluck:staging-build-df4fd72)
# $(eval ELASTIC_PWD=$(shell cd ${PWD}/../layerkeep-infra/staging && kubectl get secret layerkeep-es-elastic-user -n elastic-system --template={{.data.elastic}} | base64 -d))
echo "${ELASTIC_PWD}"
docker run -it -p 3002:3002 -p 5432 -p 9200 \
-e RAILS_LOG_TO_STDOUT=true \
-e RAILS_SERVE_STATIC_FILES=true \
-e SECRET_KEY_BASE=1234 \
-e PG_HOST=host.docker.internal \
-e PG_PASSWORD=d22LFEbD4zUATJT0 \
-e ELASTIC_PWD=${ELASTIC_PWD} \
-e ELASTICSEARCH_URL="https://elastic:$(ELASTIC_PWD)@host.docker.internal:9200" \
${IMAGE} bundle exec rails s -p 3002 -b 0.0.0.0
#/bin/bash
# --mount type=bind,source="$(PWD)/.cache/vendor/bundle",target=/var/www/pluck/bundlecache2,consistency=cached \
# ${IMAGE} /bin/sh -c "cp -rf vendor/bundle/* bundlecache/"
cacheit2:
$(eval IMAGE=localhost/assets:latest)
docker create -ti --name dummy ${IMAGE} /bin/bash
docker cp dummy:/var/www/pluck/vendor/bundle $(PWD)/.cache/vendor
docker cp dummy:/var/www/pluck/public $(PWD)/.cache/
docker rm -f dummy
# --mount type=bind,source="$(PWD)/.cache/vendor/bundle",target=/var/www/pluck/bundlecache2,consistency=cached \
# ${IMAGE} /bin/sh -c "cp -rf vendor/bundle/* bundlecache/"
cacheit:
docker run --privileged --rm \
-v $(PWD)/.cache/vendor/bundle:/var/www/pluck/bundlecache \
-v $(PWD)/.cache/public:/var/www/pluck/publiccache \
${IMAGE} /bin/sh -c "cp -rf vendor/bundle/* bundlecache/ && cp -rf public/* publiccache/"
cacheyarn:
$(eval IMAGE=localhost/pluck:test7)
echo ${IMAGE}
docker run --rm \
-v ${PWD}/yarn_cache:/var/www/pluck/nodecache \
${IMAGE} /bin/sh -c 'CACHE_DIR=$$(yarn cache dir) && cp -rf $${CACHE_DIR} nodecache/'
# ${IMAGE} /bin/sh -c 'CACHE_DIR=$$(yarn cache dir) cp -rf $${CACHE_DIR} nodecache/'
# ${IMAGE} /bin/sh -c 'echo $$(yarn cache dir)'