From 7e92ad2ea183d6668d4c3bed938a805bb1956f2f Mon Sep 17 00:00:00 2001 From: "Jon R. Humphrey" Date: Thu, 25 Apr 2024 13:17:27 +0100 Subject: [PATCH] build: Makefile updates removes auth target, as well as echos for tracking, alongside reassigning NAME instead of REPO where applicable --- Makefile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 8819e874..d12ec5d1 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -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} @@ -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} @@ -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} \ @@ -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. @@ -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. @@ -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) @@ -111,5 +109,6 @@ vars: @echo "SHORTNAME = ${SHORTNAME}" @echo "STAGE = ${STAGE}" @echo "COMMIT = ${COMMIT}" + @echo "REPO = ${REPO}" @echo "TAG = ${TAG}" @echo "VERSION = ${VERSION}"