Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1 make smm extractor clowder v2 compatible #3

Merged
merged 28 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5a0c783
update name entity extractor
longshuicy Oct 3, 2023
185d24f
changelog
longshuicy Oct 3, 2023
761b0b0
update network analysis
longshuicy Oct 3, 2023
52bee0b
update information
longshuicy Oct 3, 2023
6fce306
bump to 3.0.4
longshuicy Oct 3, 2023
2d707c2
add clowder version as environment variable
longshuicy Oct 3, 2023
555ff79
update changelog and extractor info
longshuicy Oct 5, 2023
537d5c5
typo
longshuicy Oct 5, 2023
0bd48a3
if there is base image use base image
longshuicy Oct 5, 2023
1e48bf4
typo
longshuicy Oct 5, 2023
7d5ef6c
try if i can base off smm image
longshuicy Oct 6, 2023
315a1ba
clean up the repository
longshuicy Oct 6, 2023
a6b1a16
update readme
longshuicy Oct 6, 2023
e3f4b85
due to security reason you have to build from local folder
longshuicy Oct 6, 2023
79fe89a
add a github docker build workflow
longshuicy Oct 6, 2023
1b8f3c0
update matrix name
longshuicy Oct 6, 2023
232fe54
point to specific file
longshuicy Oct 6, 2023
7451762
file
longshuicy Oct 6, 2023
7bed83a
lowercase
longshuicy Oct 6, 2023
6b14fed
update matrix
longshuicy Oct 6, 2023
ebade5f
wrong path
longshuicy Oct 6, 2023
61ad3dc
push to clowder dockerhub instead
longshuicy Oct 6, 2023
5419929
use social media macrsocope
longshuicy Oct 6, 2023
de56aac
add readme
longshuicy Oct 6, 2023
ce7bfd5
name entity recognition use pip3
longshuicy Oct 6, 2023
8797071
enforce latest environment variable
longshuicy Oct 6, 2023
8f94ec8
need to install the correct version of pyclowder
longshuicy Oct 6, 2023
b15bf8d
heartbeat
longshuicy Oct 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: Docker

# This will run when:
# - a new release is created, to make sure the right tags of the
# docker images are pushed (expects tags to be v1.8.4).
# - when new code is pushed to main/develop to push the tags
# latest and develop
# - when a pull request is created and updated to make sure the
# Dockerfile is still valid.
# To be able to push to dockerhub, this execpts the following
# secrets to be set in the project:
# - DOCKERHUB_USERNAME : username that can push to the org
# - DOCKERHUB_PASSWORD : password asscoaited with the username
on:
push:
branches:
- main

pull_request:

# Certain actions will only run when this is the main repo.
env:
MAIN_REPO: clowder-framework/smm-extractor
DOCKERHUB_ORG: socialmediamacroscope

jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write

strategy:
fail-fast: false
matrix:
include:
- name: name_entity_recognition_extractor
FOLDER: name_entity_recognition_extractor
PLATFORM: "linux/amd64,linux/arm64"
- name: network_analysis_extractor
FOLDER: network_analysis_extractor
PLATFORM: "linux/amd64,linux/arm64"
- name: preprocessing_extractor
FOLDER: preprocessing_extractor
PLATFORM: "linux/amd64,linux/arm64"
- name: sentiment_analysis_extractor
FOLDER: sentiment_analysis_extractor
PLATFORM: "linux/amd64,linux/arm64"
- name: topic_modeling_extractor
FOLDER: topic_modeling_extractor
PLATFORM: "linux/amd64,linux/arm64"

steps:
- uses: actions/checkout@v2

# set environment variables
- name: Extractor Version
run: |
# find out what the BRANCH is, in case of a PR we will use the PR-<number>
if [ "${{ github.event.release.target_commitish }}" != "" ]; then
BRANCH="${{ github.event.release.target_commitish }}"
elif [[ $GITHUB_REF =~ pull ]]; then
BRANCH="$(echo $GITHUB_REF | sed 's#refs/pull/\([0-9]*\)/merge#PR-\1#')"
else
BRANCH=${GITHUB_REF##*/}
fi

# should we push to dockerhub, and is there a README
DOCKERHUB_PUSH="false"
DOCKERHUB_README="false"
if [ "$BRANCH" == "main" -a "${{ github.repository }}" == "${{ env.MAIN_REPO }}" ]; then
if [ "${{ secrets.SMM_DOCKERHUB_USERNAME }}" != "" -a "${{ secrets.SMM_DOCKERHUB_PASSWORD }}" != "" ]; then
DOCKERHUB_PUSH="true"
if [ -e "${{ matrix.FOLDER }}/README.md" ]; then
DOCKERHUB_README="true"
fi
fi
fi

# calculate the version and all tags
if [ "$BRANCH" == "main" ]; then
VERSION="$(awk '/"version":/ { print $2 }' ${{ matrix.FOLDER }}/extractor_info.json | sed 's/^.*"\([0-9\.]*\)".*$/\1/')"
tags="latest"
oldversion=""
tmpversion="${VERSION}"
while [ "${oldversion}" != "${tmpversion}" ]; do
oldversion="${tmpversion}"
tags="${tags} ${tmpversion}"
tmpversion=${tmpversion%.*}
done
else
VERSION="test"
tags="$BRANCH"
fi

# create a list of all images to be pushed
IMAGE=${{ matrix.name }}
IMAGES=""
for tag in ${tags}; do
if [ "$DOCKERHUB_PUSH" == "true" ]; then
IMAGES="${IMAGES}${{ env.DOCKERHUB_ORG }}/${IMAGE}:${tag},"
fi
IMAGES="${IMAGES}ghcr.io/${{ github.repository_owner }}/${IMAGE}:${tag},"
done
IMAGES="${IMAGES%,*}"

# save the results in env
echo "BRANCH=${BRANCH}"
echo "VERSION=${VERSION}"
echo "DOCKERHUB_README=${DOCKERHUB_README}"
echo "DOCKERHUB_PUSH=${DOCKERHUB_PUSH}"
echo "IMAGES=${IMAGES}"

echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "DOCKERHUB_README=${DOCKERHUB_README}" >> $GITHUB_ENV
echo "DOCKERHUB_PUSH=${DOCKERHUB_PUSH}" >> $GITHUB_ENV
echo "IMAGES=${IMAGES}" >> $GITHUB_ENV

# setup docker build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Inspect Builder
run: |
echo "Name: ${{ steps.buildx.outputs.name }}"
echo "Endpoint: ${{ steps.buildx.outputs.endpoint }}"
echo "Status: ${{ steps.buildx.outputs.status }}"
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"

# login to registries
- name: Login to DockerHub
if: env.DOCKERHUB_PUSH == 'true'
uses: docker/login-action@v2
with:
username: ${{ secrets.SMM_DOCKERHUB_USERNAME }}
password: ${{ secrets.SMM_DOCKERHUB_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# build the docker images
- name: Build and push ${{ matrix.name }}
uses: docker/build-push-action@v2
with:
push: true
file: ${{ matrix.FOLDER }}/extractor.dockerfile
context: ${{ matrix.FOLDER }}
platforms: ${{ matrix.PLATFORM }}
cache-from: type=gha,scope=${{ matrix.name }}
cache-to: type=gha,mode=max,scope=${{ matrix.name }}
tags: ${{ env.IMAGES }}
build-args: |
VERSION=${{ env.VERSION }}
BUILDNUMBER=${{ github.run_number }}
GITSHA1=${{ github.sha }}

# this will update the README of the dockerhub repo
- name: Docker Hub Description
if: env.DOCKERHUB_README == 'true'
uses: peter-evans/dockerhub-description@v2
env:
DOCKERHUB_USERNAME: ${{ secrets.SMM_DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.SMM_DOCKERHUB_PASSWORD }}
DOCKERHUB_REPOSITORY: ${{ env.DOCKERHUB_ORG }}/${{ matrix.name }}
README_FILEPATH: ${{ matrix.FOLDER }}/README.md
14 changes: 14 additions & 0 deletions command.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
docker build -f extractor.dockerfile -t socialmediamacroscope/name_entity_recognition_extractor:latest .
docker push socialmediamacroscope/name_entity_recognition_extractor:latest

docker build -f extractor.dockerfile -t socialmediamacroscope/network_analysis_extractor:latest .
docker push socialmediamacroscope/network_analysis_extractor:latest

docker build -f extractor.dockerfile -t socialmediamacroscope/preprocessing_extractor:latest .
docker push socialmediamacroscope/preprocessing_extractor:latest

docker build -f extractor.dockerfile -t socialmediamacroscope/sentiment_analysis_extractor:latest .
docker push socialmediamacroscope/sentiment_analysis_extractor:latest

docker build -f extractor.dockerfile -t socialmediamacroscope/topic_modeling_extractor:latest .
docker push socialmediamacroscope/topic_modeling_extractor:latest
Loading
Loading