Skip to content

Commit

Permalink
Update build workflow to set docker image tag based on branch or late…
Browse files Browse the repository at this point in the history
…st tag
  • Loading branch information
jjjermiah committed Jan 22, 2024
1 parent 17cce65 commit 97eb2a8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
25 changes: 19 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ jobs:
# The docker image tag is the git release tag
# If there is no release tag, then we will use the branch name
# as the docker image tag
- name: Get latest tag name
id: last_tag
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 | sed 's/^v//')
echo $LATEST_TAG
- name: Get latest tag name 2
run: |
echo "LATEST_TAG_NEW=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> "$GITHUB_ENV"
Expand All @@ -40,3 +34,22 @@ jobs:
run: |
printf "%s\n" "${LATEST_TAG_NEW}"
- name: Get branch name
run: |
echo "BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)" >> "$GITHUB_ENV"
- name: Print branch name
run: |
printf "%s\n" "${BRANCH_NAME}"
- name: Set docker image tag
run: |
if [ -z "${LATEST_TAG_NEW}" ]; then
echo "DOCKER_IMAGE_TAG=${BRANCH_NAME}" >> "$GITHUB_ENV"
else
echo "DOCKER_IMAGE_TAG=${LATEST_TAG_NEW}" >> "$GITHUB_ENV"
fi
- name: Print docker image tag
run: |
printf "%s\n" "${DOCKER_IMAGE_TAG}"
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# This Dockerfile will create a container that builds the nbiatoolkit package
# using the code in this repository
#
# To build the container, run the following command from the root of the
# repository:
# docker build -t nbiatoolkit .
#

FROM python:3.12-slim

# install the dependencies
RUN python -m pip install nbiatoolkit

RUN python -c 'import nbiatoolkit; print(nbiatoolkit.__version__)'

# On run, open a bash shell
CMD ["/bin/bash"]

# to run this container in terminal mode, use the following command:
# docker run -it --rm nbiatoolkit

0 comments on commit 97eb2a8

Please sign in to comment.