Skip to content

Commit

Permalink
Updates to build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Syntaf committed Nov 11, 2024
1 parent 1231de2 commit 929e334
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
2 changes: 1 addition & 1 deletion Dockerfile.production
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ENV INSTALL_PATH /opt/wetrockpolice
RUN mkdir -p $INSTALL_PATH

# nodejs, yarn & bun
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_20.x | bash -
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg -o /root/yarn-pubkey.gpg && apt-key add /root/yarn-pubkey.gpg
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install -y --no-install-recommends nodejs yarn python3 python-is-python3
Expand Down
53 changes: 29 additions & 24 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,6 @@ SHELL=/opt/homebrew/bin/bash
http:
bundle exec rails server -p 3002 -b 0.0.0.0

.PHONY: build
build:
docker build -t syntaf/wetrockpolice:$(LATEST_HASH) \
--build-arg RAILS_ENV=production \
-f ./Dockerfile.production \
.

.PHONY: push
push:
docker push syntaf/wetrockpolice:$(LATEST_HASH)

.PHONY: sync
sync:
yq -i ".image.tag = \"$$(kubectl get pods -n wetrockpolice -l app.kubernetes.io/name=wetrockpolice -o=jsonpath='{$$.items[*].spec.containers[*].image}' | head -n 1 | awk '{print $$1}' | awk -F':' '{print $$2}')\"" k8s/wetrockpolice/values.yaml
yq -i ".appVersion = \"$$(kubectl get pods -n wetrockpolice -l app.kubernetes.io/name=wetrockpolice -o=jsonpath='{$$.items[*].metadata.annotations.wetrockpolice-app-version}' | awk -F' ' '{print $$2}')\"" k8s/wetrockpolice/Chart.yaml

.PHONY: deploy
deploy:
helm upgrade -n wetrockpolice -f secrets.yaml wetrockpolice k8s/wetrockpolice

.PHONY: commit
commit:
echo $(LATEST_HASH) > version.txt

.PHONY: worker
worker:
bundle exec sidekiq -q default -q mailers
Expand Down Expand Up @@ -71,3 +47,32 @@ init: db-create db-migrate db-seed

.PHONY: reset_db
reset-db: restart-pg db-drop init

# Deployment
# --------------------------------------------------
LATEST_HASH := $(shell cat .git/refs/heads/master)
LATEST_GIT_TAG := $(shell git describe --abbrev=0 --tags)
LATEST_CHART_VERSION := $(shell yq e '.version' k8s/wetrockpolice/Chart.yaml)

.PHONY: build
build:
docker build -t syntaf/wetrockpolice:$(LATEST_HASH) \
-f ./Dockerfile.production \
.

.PHONY: push
push:
docker push syntaf/wetrockpolice:$(LATEST_HASH)

.PHONY: sync
sync:
yq -i ".image.tag = \"$$(kubectl get pods -n wetrockpolice -l app.kubernetes.io/name=wetrockpolice -o=jsonpath='{$$.items[*].spec.containers[*].image}' | head -n 1 | awk '{print $$1}' | awk -F':' '{print $$2}')\"" k8s/wetrockpolice/values.yaml
yq -i ".appVersion = \"$$(kubectl get pods -n wetrockpolice -l app.kubernetes.io/name=wetrockpolice -o=jsonpath='{$$.items[*].metadata.annotations.wetrockpolice-app-version}' | awk -F' ' '{print $$2}')\"" k8s/wetrockpolice/Chart.yaml

.PHONY: deploy
deploy:
helm upgrade -n wetrockpolice -f secrets.yaml wetrockpolice k8s/wetrockpolice

.PHONY: commit
commit:
echo $(LATEST_HASH) > version.txt
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5246ba5bad001425d3748213dc72c3ab9d9d878b
94950b003f09b371d01e7856b44298c9e0e5b489

0 comments on commit 929e334

Please sign in to comment.