Skip to content

Commit

Permalink
build: Makefile updates
Browse files Browse the repository at this point in the history
removes auth target, as well as echos for tracking, alongside reassigning NAME instead of REPO where applicable
  • Loading branch information
jonrandahl committed Apr 25, 2024
1 parent 9cca65d commit 7e92ad2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: assets auth check clean image lint publish realclean run tag test vars
.PHONY: assets check clean image lint publish realclean run tag test vars

ACCOUNT?=$(shell aws sts get-caller-identity | jq -r .Account)
ALPINE_VERSION?=3.13
Expand All @@ -17,7 +17,7 @@ API_SERVICE_URL?=http://data-api:8080
BRANCH:=$(shell git rev-parse --abbrev-ref HEAD)
COMMIT=$(shell git rev-parse --short HEAD)
VERSION?=$(shell /usr/bin/env ruby -e 'require "./app/lib/version" ; puts Version::VERSION')
TAG?=$(shell printf '%s-%s-%08d' ${VERSION} ${COMMIT} ${GITHUB_RUN_NUMBER})
TAG?=$(shell printf '%s_%s_%08d' ${VERSION} ${COMMIT} ${GITHUB_RUN_NUMBER})

${TAG}:
@echo ${TAG}
Expand All @@ -36,12 +36,9 @@ ${BUNDLE_CFG}: ${GITHUB_TOKEN}
${GITHUB_TOKEN}:
@echo ${PAT} > ${GITHUB_TOKEN}

assets: auth
@echo "Installing all gems ..."
assets:
@./bin/bundle install
@echo "Installing yarn packages ..."
yarn install
@echo "Removing old compiled assets and compiling all the assets named in config.assets.precompile ..."
@yarn install
@./bin/rails assets:clean assets:precompile

auth: ${GITHUB_TOKEN} ${BUNDLE_CFG}
Expand All @@ -54,7 +51,7 @@ clean:
@@ rm -rf bundle coverage log node_modules

image: auth
@echo Building ${REPO}:${TAG} ...
@echo Building ${NAME}:${TAG} ...
@docker build \
--build-arg ALPINE_VERSION=${ALPINE_VERSION} \
--build-arg RUBY_VERSION=${RUBY_VERSION} \
Expand All @@ -64,7 +61,7 @@ image: auth
--build-arg git_commit_hash=${COMMIT} \
--build-arg github_run_number=${GITHUB_RUN_NUMBER} \
--build-arg image_name=${NAME} \
--tag ${REPO}:${TAG} \
--tag ${NAME}:${TAG} \
.
@echo Done.

Expand All @@ -73,6 +70,7 @@ lint: assets

publish: image
@echo Publishing image: ${REPO}:${TAG} ...
@docker tag ${NAME}:${TAG} ${REPO}:${TAG} 2>&1
@docker push ${REPO}:${TAG} 2>&1
@echo Done.

Expand All @@ -81,7 +79,7 @@ realclean: clean

run: start
@if docker network inspect dnet > /dev/null 2>&1; then echo "Using docker network dnet"; else echo "Create docker network dnet"; docker network create dnet; sleep 2; fi
@docker run -p ${PORT}:3000 -e API_SERVICE_URL=${API_SERVICE_URL} --network dnet --rm --name ${SHORTNAME} ${REPO}:${TAG}
@docker run -p ${PORT}:3000 -e API_SERVICE_URL=${API_SERVICE_URL} --network dnet --rm --name ${SHORTNAME} ${NAME}:${TAG}

server: assets start
@export SECRET_KEY_BASE=$(./bin/rails secret)
Expand Down Expand Up @@ -111,5 +109,6 @@ vars:
@echo "SHORTNAME = ${SHORTNAME}"
@echo "STAGE = ${STAGE}"
@echo "COMMIT = ${COMMIT}"
@echo "REPO = ${REPO}"
@echo "TAG = ${TAG}"
@echo "VERSION = ${VERSION}"

0 comments on commit 7e92ad2

Please sign in to comment.