Skip to content

Commit

Permalink
Use docker/metadata-action
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Aug 29, 2024
1 parent b250b20 commit aef3de0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
36 changes: 16 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,21 @@ jobs:
needs: [ test ]
if: github.event_name == 'push' || github.event_name == 'release'
runs-on: ubuntu-24.04
env:
repo_name: fnndsc/cube
steps:
- name: Determine image tags
id: determine
run: |
repo="${{ env.repo_name }}"
tag="${GITHUB_REF_NAME:-latest}" # if build triggered by tag, use tag name
# if tag is a version number prefixed by 'v', remove the 'v'
if [[ "$tag" =~ ^v[0-9].* ]]; then
tag="${tag:1}"
fi
dock_image=$repo:$tag
echo $dock_image
echo "dock_image=$dock_image" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
docker.io/fnndsc/cube
ghcr.io/fnndsc/cube
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=raw,value=latest,enable={{is_default_branch}}
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
Expand All @@ -67,12 +64,11 @@ jobs:
push: true
context: .
file: ./Dockerfile
tags: |
docker.io/${{ steps.determine.outputs.dock_image }}
ghcr.io/${{ steps.determine.outputs.dock_image }}
platforms: linux/amd64,linux/ppc64le,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v4
Expand All @@ -81,4 +77,4 @@ jobs:
password: ${{ secrets.DOCKERHUB_PASSWORD }}
short-description: ChRIS backend
readme-filepath: ./README.md
repository: ${{ env.repo_name }}
repository: fnndsc/cube
9 changes: 0 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,5 @@ RUN if [ "$ENVIRONMENT" = "production" ]; then \

CMD ["gunicorn", "-b", "0.0.0.0:8000", "-w", "4", "config.wsgi:application"]

LABEL org.opencontainers.image.authors="FNNDSC <[email protected]>" \
org.opencontainers.image.title="ChRIS Backend" \
org.opencontainers.image.description="ChRIS backend django API server" \
org.opencontainers.image.url="https://chrisproject.org/" \
org.opencontainers.image.source="https://github.com/FNNDSC/ChRIS_ultron_backEnd" \
org.opencontainers.image.documentation="https://github.com/FNNDSC/ChRIS_ultron_backEnd/wiki/" \
org.opencontainers.image.version="" \
org.opencontainers.image.licenses="MIT"

HEALTHCHECK --interval=30s --timeout=5s \
CMD curl -f http://localhost:8000/api/v1/users/ || exit 1

0 comments on commit aef3de0

Please sign in to comment.