Skip to content

Commit a31e0cd

Browse files
committed
Update makefile and docker to handle GH builds
1 parent 82d5986 commit a31e0cd

2 files changed

Lines changed: 30 additions & 5 deletions

File tree

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,17 @@ RUN pipenv install --dev --system --deploy
1717
RUN apt-get clean autoclean && \
1818
apt-get autoremove --yes && \
1919
rm -rf /var/lib/{apt,dpkg,cache,log}/
20+
21+
ARG BUILD_DATETIME
22+
ARG SHA1
23+
ARG VERSION
24+
25+
LABEL io.github.mbeacom.description="CloudEndure CLI and API client module" \
26+
io.github.mbeacom.documentation="https://mbeacom.github.io/cloudendure-python/" \
27+
io.github.mbeacom.licenses="MIT" \
28+
io.github.mbeacom.image.revision=$SHA1 \
29+
io.github.mbeacom.image.version=$VERSION \
30+
io.github.mbeacom.image.vendor="mbeacom" \
31+
io.github.mbeacom.image.source="https://github.com/mbeacom/cloudendure-python" \
32+
io.github.mbeacom.image.title="CloudEndure Client" \
33+
io.github.mbeacom.image.created=$BUILD_DATETIME

Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
REPO_NAME := mbeacom/cloudendure-python
77
SHA1 := $$(git log -1 --pretty=%h)
88
CURRENT_BRANCH := $$(git symbolic-ref -q --short HEAD)
9+
LATEST_TAG := ${REPO_NAME}:latest
10+
GIT_TAG := ${REPO_NAME}:${SHA1}
11+
VERSION := v0.0.9
912

1013
info: ## Show information about the current git state.
1114
@echo "Github Project: https://github.com/${REPO_NAME}\nCurrent Branch: ${CURRENT_BRANCH}\nSHA1: ${SHA1}\n"
@@ -16,12 +19,20 @@ build: ## Build the Gitcoin Web image.
1619
--pull \
1720
--build-arg BUILD_DATETIME=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
1821
--build-arg "SHA1=${SHA1}" \
19-
${VERSION:+--build-arg "VERSION=$VERSION"} \
22+
--build-arg "VERSION=${VERSION}" \
2023
-t "${GIT_TAG}" .
2124
@docker tag "${GIT_TAG}" "${LATEST_TAG}"
25+
@docker tag "${GIT_TAG}" "${VERSION}"
26+
27+
gh_push: ## Push the Github Docker image.
28+
@docker tag ${GIT_TAG} docker.pkg.github.com/mbeacom/cloudendure-python/cloudendure:${VERSION}
29+
@docker push docker.pkg.github.com/mbeacom/cloudendure-python/cloudendure:${VERSION}
2230

2331
login: ## Login to Docker Hub.
24-
@docker log -u "${DOCKER_USER}" -p "${DOCKER_PASS}"
32+
@docker login -u "${DOCKER_USER}" -p "${DOCKER_PASS}"
33+
34+
gh_login: ## Login to Docker Hub.
35+
@docker login docker.pkg.github.com -u "${DOCKER_GH_USER}" -p "${DOCKER_GH_TOKEN}"
2536

2637
push: ## Push the Docker image to the Docker Hub repository.
2738
@docker push "${REPO_NAME}"
@@ -83,11 +94,11 @@ gen_client: ## Generate the swagger client from the API config.
8394
update_deps: update_prereqs ## Update the package dependencies via pipenv.
8495
@pipenv update --pre --dev
8596

86-
build: update_deps ## Build and package the project for PyPi source and wheel distribution.
87-
@pipenv run python3 setup.py sdist bdist_wheel
88-
8997
install: isort build ## Install the local development version of the module.
9098
@pipenv install .
9199

100+
build_py: update_deps ## Build and package the project for PyPi source and wheel distribution.
101+
@pipenv run python3 setup.py sdist bdist_wheel
102+
92103
help: ## Show this help information.
93104
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[33m%-25s\033[0m %s\n", $$1, $$2}'

0 commit comments

Comments
 (0)