Skip to content

Commit

Permalink
Merge pull request #45 from jjjermiah/devel
Browse files Browse the repository at this point in the history
Devel
  • Loading branch information
jjjermiah committed Jan 22, 2024
2 parents 0ff2ded + 5bce197 commit 2b33361
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,80 @@ jobs:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}


build:
needs: Continuous-Deployment
runs-on: ubuntu-latest
# first we need to check out the code
steps:
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12

- name: Check-out repository
uses: actions/checkout@v2
with:
fetch-depth: 0


# 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 2
run: |
echo "LATEST_TAG_NEW=$(git describe --tags --abbrev=0 | sed 's/^v//')" >> "$GITHUB_ENV"
- name: Print latest tag name
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}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:${{ env.DOCKER_IMAGE_TAG }}

- name: Test Image
run: |
docker run --rm \
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:${{ env.DOCKER_IMAGE_TAG }} \
python -c "import nbiatoolkit; print(nbiatoolkit.__version__)"
# # - name: Publish package distributions to GitHub Releases
# - name: Build and Publish
# uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
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 2b33361

Please sign in to comment.