From c7209fb021e26872e59838917da36ff32a6b0297 Mon Sep 17 00:00:00 2001 From: Jason Kai <21226986+kaitj@users.noreply.github.com> Date: Mon, 17 Feb 2025 15:17:16 -0500 Subject: [PATCH 1/2] Add fastsurfer dockerfile - Build off of official image, but add binary directory to path - Use package version as tag --- packages/fastsurfer.dockerfile | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 packages/fastsurfer.dockerfile diff --git a/packages/fastsurfer.dockerfile b/packages/fastsurfer.dockerfile new file mode 100644 index 000000000..96db6826f --- /dev/null +++ b/packages/fastsurfer.dockerfile @@ -0,0 +1,3 @@ +FROM deepmi/fastsurfer:2.5.3 + +ENV PATH="/fastsurfer:$PATH" From 4cc353ce45b217e0825dc86f2694bf5690bdade8 Mon Sep 17 00:00:00 2001 From: Jason Kai <21226986+kaitj@users.noreply.github.com> Date: Mon, 17 Feb 2025 16:09:39 -0500 Subject: [PATCH 2/2] Add initial workflow for building container --- .github/workflows/deploy-docker.yaml | 88 ++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 .github/workflows/deploy-docker.yaml diff --git a/.github/workflows/deploy-docker.yaml b/.github/workflows/deploy-docker.yaml new file mode 100644 index 000000000..29a0247d9 --- /dev/null +++ b/.github/workflows/deploy-docker.yaml @@ -0,0 +1,88 @@ +name: Deploy container to DockerHub + +on: + workflow_dispatch: + +jobs: + docker-deploy: + name: Docker Deploy + runs-on: ubuntu-latest + + steps: + - name: Maximize build space + uses: easimon/maximize-build-space@v10 + with: + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' + remove-docker-images: 'true' + overprovision-lvm: 'true' + + - uses: actions/checkout@v4 + + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USER }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Check, build, and push Docker images + run: | + # Function to check if tag exists in DockerHub + check_tag_exists() { + local image_name=$1 + local tag=$2 + + # Get Docker Hub token + TOKEN=$(curl -s -H "Content-Type: application/json" -X POST \ + -d "{\"username\": \"${{ secrets.DOCKERHUB_USERNAME }}\", \"password\": \"${{ secrets.DOCKERHUB_TOKEN }}\"}" \ + https://hub.docker.com/v2/users/login/ | jq -r .token) + + # Check if the tag exists + HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" \ + -H "Authorization: JWT ${TOKEN}" \ + "https://hub.docker.com/v2/repositories/${image_name}/tags/${tag}/") + + if [ "$HTTP_CODE" -eq 200 ]; then + return 0 # Tag exists + fi + return 1 # Tag does not exist + } + + # For each package descriptor in the packages directory + pushd packages > /dev/null + for json_file in *.json; do + # Get the package name + package_name="$(json_file%.json)" + + # Check if corresponding dockerfile exists + dockerfile="${package_name}.dockerfile" + if [ ! -f "$dockerfile" ]; then + echo "Warning: No dockerfile found for $json_file" + continue + fi + + # Extract version from package.json + version=$(jq -r '.version' "$json_file") + + # Build the image name + image_name="${{ secrets.DOCKERHUB_USERNAME }}/${package_name}" + + echo "Checking if $image_name:$version exists..." + + if check_tag_exists "$image_name" "$version"; then + echo "Version $version already exists for $image_name, skipping build" + continue + fi + + echo "Building $image_name:$version" + + # Build and push docker image + docker build \ + -t "$image_name:$version" \ + -f "$dockerfile" \ + . \ + --push + + popd > /dev/null