-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (49 loc) · 1.77 KB
/
Makefile
File metadata and controls
70 lines (49 loc) · 1.77 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
run:
python src/main.py
test:
pytest tests/
#########
### DOCKER LOCAL
#########
build_container_local:
docker build --tag=$$IMAGE:dev .
run_container_local:
docker run -it -e PORT=8000 -p 8000:8000 $$IMAGE:dev
#####
## PUSH IMAGE TO DOCKER
#####
## AUTHENTICATE DOCKER
allow_docker_push:
gcloud auth configure-docker $$GCP_REGION-docker.pkg.dev
## CREATE ARTIFACTS REPO
create_artifacts_repo:
gcloud artifacts repositories create $$ARTIFACTSREPO --repository-format=docker \
--location=$$GCP_REGION --description="Repository for storing images"
## BUILD IMAGE
build_for_production:
docker build -t $$GCP_REGION-docker.pkg.dev/$$GCP_PROJECT/$$ARTIFACTSREPO/$$IMAGE:prod .
######
## ONLY FOR MAC USERS IN ORDER TO BUILD IMAGES
######
m_chip_build_image_production:
docker build --platform linux/amd64 -t $$GCP_REGION-docker.pkg.dev/$$GCP_PROJECT/$$ARTIFACTSREPO/$$IMAGE:prod .
## PUSHING IMAGE TO DOCKER
push_image_production:
docker push $$GCP_REGION-docker.pkg.dev/$$GCP_PROJECT/$$ARTIFACTSREPO/$$IMAGE:prod
## DEPLOY TO CLOUD RUN
deploy_to_cloud_run:
gcloud run deploy --image $$GCP_REGION-docker.pkg.dev/$$GCP_PROJECT/$$ARTIFACTSREPO/$$IMAGE:prod --memory $$MEMORY --region $$GCP_REGION
## DEPLOY TO CLOUD RUN WITH COSTOM DOMAIN
deploy_to_cloud_run_with_custom_domain:
gcloud beta run domain-mappings create --service $$GCP_PROJECT --domain $$CUSTOM_DOMAIN
## STOP SERVICES RUNNING SERVICES TO AVOID EXTRA COSTS
cloud_run_disable_service:
gcloud run services update $$INSTANCE --min-instances=0
############################################
######## DELETE SERVICES ################
############################################
cloud_run_delete_service:
gcloud run services delete $$INSTANCE
############################################
app_run:
streamlit run src/app.py