-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (61 loc) · 1.74 KB
/
Makefile
File metadata and controls
70 lines (61 loc) · 1.74 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
.PHONY: up check
include .env
IMAGE ?= tulibraries/isilon_tracker
VERSION ?= $(DOCKER_IMAGE_VERSION)
HARBOR ?= harbor.k8s.temple.edu
BASE_IMAGE ?= harbor.k8s.temple.edu/library/ruby:3.4-alpine
PLATFORM ?= linux/x86_64
CLEAR_CACHES ?= no
SECRET_KEY_BASE ?= $(ISILON_TRACKER_SECRET_KEY_BASE)
CI ?= false
ISILON_TRACKER_DB_HOST ?= host.docker.internal
ISILON_TRACKER_DB_USER ?= postgres
DEFAULT_RUN_ARGS ?= -e "EXECJS_RUNTIME=Disabled" \
-e "K8=yes" \
-e "RAILS_ENV=production" \
-e "SECRET_KEY_BASE=$(SECRET_KEY_BASE)" \
-e "RAILS_SERVE_STATIC_FILES=yes" \
-e "RAILS_LOG_TO_STDOUT=yes" \
--rm -it
build:
@docker build --pull --build-arg RAILS_MASTER_KEY=$(RAILS_MASTER_KEY) \
--build-arg SECRET_KEY_BASE=$(SECRET_KEY_BASE) \
--build-arg BASE_IMAGE=$(BASE_IMAGE) \
--platform $(PLATFORM) \
--progress plain \
--tag $(HARBOR)/$(IMAGE):$(VERSION) \
--tag $(HARBOR)/$(IMAGE):latest \
--file .docker/app/Dockerfile \
--no-cache .
run:
@docker run --name=isilon_tracker -p 127.0.0.1:3001:3000/tcp \
--platform $(PLATFORM) \
$(DEFAULT_RUN_ARGS) \
$(HARBOR)/$(IMAGE):$(VERSION)
lint:
@if [ $(CI) == false ]; \
then \
hadolint .docker/app/Dockerfile; \
fi
scan:
@if [ $(CLEAR_CACHES) == yes ]; \
then \
trivy image --scanners vuln -c $(HARBOR)/$(IMAGE):$(VERSION); \
fi
@if [ $(CI) == false ]; \
then \
trivy image --scanners vuln $(HARBOR)/$(IMAGE):$(VERSION); \
fi
deploy: scan lint
@docker push $(HARBOR)/$(IMAGE):$(VERSION) \
# This "if" statement needs to be a one liner or it will fail.
# Do not edit indentation
@if [ $(VERSION) != latest ]; \
then \
docker push $(HARBOR)/$(IMAGE):latest; \
fi
up:
bundle install
bundle exec rake db:setup
bundle exec rake db:migrate
bundle exec rails s -d -p 3000