-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
104 lines (78 loc) · 5.12 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
98
99
100
101
102
103
104
#-------------------------------------------------------------------------------------------------------------------------------------------------
# Variables
#-------------------------------------------------------------------------------------------------------------------------------------------------
# Define Docker contexts
HASHTAGCOLLECTOR_CONTEXT=./scripts/scrape_hashtags
DATACOLLECTOR_CONTEXT=./scripts/scrape_tweets
FRONTEND_CONTEXT=./scripts/application
TRAIN_CONTEXT=./scripts/text_generator
# Define DockerHub locations
DOCKERHUB_LOCATION_HASHTAGCOLLECTOR=moritzwilksch/dukerepo:hashtagcollector
DOCKERHUB_LOCATION_DATACOLLECTOR=moritzwilksch/dukerepo:datacollector
DOCKERHUB_LOCATION_FRONTEND=moritzwilksch/dukerepo:frontend
DOCKERHUB_LOCATION_MODELTRAIN=moritzwilksch/dukerepo:modeltrain
#-------------------------------------------------------------------------------------------------------------------------------------------------
# Normal Targets
#-------------------------------------------------------------------------------------------------------------------------------------------------
install:
pip install --upgrade pip
pip install -r requirements.txt
run-frontend:
uvicorn --app-dir scripts/application/ app:app --reload --host 0.0.0.0 --port 8080
test:
pytest tests/
############################################### DOCKER ######################################################
#-------------------------------------------------------------------------------------------------------------------------------------------------
# Hashtag Data Collection
#-------------------------------------------------------------------------------------------------------------------------------------------------
docker/build-hashtags: docker/clean-hashtags
docker build --rm -t hashtagcollector -f Dockerfiles/Dockerfile.scrapehashtags $(HASHTAGCOLLECTOR_CONTEXT)/
docker/build-push-hashtags: docker/clean-hashtags # NOT in production!!!
docker build --rm -t $(DOCKERHUB_LOCATION_HASHTAGCOLLECTOR) -f Dockerfiles/Dockerfile.scrapehashtags $(HASHTAGCOLLECTOR_CONTEXT)/
docker push $(DOCKERHUB_LOCATION_HASHTAGCOLLECTOR)
docker/build-push-aws-hashtags: docker/build-hashtags # Production target
docker tag hashtagcollector 533527479286.dkr.ecr.us-east-1.amazonaws.com/dukerepo:latest
docker push 533527479286.dkr.ecr.us-east-1.amazonaws.com/dukerepo:latest
docker/run-hashtags: docker/clean-hashtags
docker run -it --name hashtagcollector --env-file Dockerfiles/env.list hashtagcollector
docker/clean-hashtags:
docker rm -f hashtagcollector
#-------------------------------------------------------------------------------------------------------------------------------------------------
# Tweet Data Collection
#-------------------------------------------------------------------------------------------------------------------------------------------------
docker/build:
docker build --rm -t datacollector -f Dockerfiles/Dockerfile.scrapetweets $(DATACOLLECTOR_CONTEXT)/
docker/build-push:
docker build --rm -t $(DOCKERHUB_LOCATION_DATACOLLECTOR) -f Dockerfiles/Dockerfile.scrapetweets $(DATACOLLECTOR_CONTEXT)/
docker push $(DOCKERHUB_LOCATION_DATACOLLECTOR)
docker/run: docker/clean
docker run -it --name datacollector --env-file Dockerfiles/env.list datacollector
docker/clean:
docker rm -f datacollector
#-------------------------------------------------------------------------------------------------------------------------------------------------
# Frontend
#-------------------------------------------------------------------------------------------------------------------------------------------------
docker/build-frontend: docker/clean-frontend
docker build --rm -t frontend -f Dockerfiles/Dockerfile.frontend ./scripts/
docker/build-push-frontend: # NOT in production!!!
docker build --rm -t $(DOCKERHUB_LOCATION_FRONTEND) -f Dockerfiles/Dockerfile.frontend ./scripts/
docker push $(DOCKERHUB_LOCATION_FRONTEND)
docker/build-push-gcloud-frontend: docker/build-frontend # Production target
docker tag frontend us-east1-docker.pkg.dev/ids706-tweetbot/dukerepo/frontend
docker push us-east1-docker.pkg.dev/ids706-tweetbot/dukerepo/frontend
docker/run-frontend: docker/clean-frontend
docker run -it --name frontend --env-file Dockerfiles/env.list -p 8080:8080 frontend
docker/clean-frontend:
docker rm -f frontend
#-------------------------------------------------------------------------------------------------------------------------------------------------
# Training
#-------------------------------------------------------------------------------------------------------------------------------------------------
docker/build-modeltraining: docker/clean-modeltraining
docker build --rm -t modeltraining -f Dockerfiles/Dockerfile.training ./scripts/text_generator
docker/run-modeltraining: docker/clean-modeltraining
docker run -i --name modeltraining --env-file Dockerfiles/env.list modeltraining
docker/clean-modeltraining:
docker rm -f modeltraining
docker/build-push-modeltrain:
docker build --rm -t $(DOCKERHUB_LOCATION_MODELTRAIN) -f Dockerfiles/Dockerfile.training ./scripts/text_generator
docker push $(DOCKERHUB_LOCATION_MODELTRAIN)