Create sugarfunge_metadata.scale #81
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DockerBuildPush | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
jobs: | |
build-arm64: | |
runs-on: [self-hosted, linux, ARM64] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ORG_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./ | |
file: ./docker/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sugarfunge-api:arm64-latest | |
build-amd64: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ORG_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: ./ | |
file: ./docker/Dockerfile | |
push: true | |
tags: ${{ secrets.DOCKERHUB_USERNAME }}/sugarfunge-api:amd64-latest | |
manifest: | |
needs: [build-arm64, build-amd64] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ORG_TOKEN }} | |
- name: Create and Push manifest | |
run: | | |
docker manifest create ${{ secrets.DOCKERHUB_USERNAME }}/sugarfunge-api:latest \ | |
--amend ${{ secrets.DOCKERHUB_USERNAME }}/sugarfunge-api:amd64-latest \ | |
--amend ${{ secrets.DOCKERHUB_USERNAME }}/sugarfunge-api:arm64-latest | |
docker manifest push ${{ secrets.DOCKERHUB_USERNAME }}/sugarfunge-api:latest | |
test-image: | |
needs: [build-amd64] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_ORG_TOKEN }} | |
- name: Pull Docker Image (AMD64) | |
run: docker pull ${{ secrets.DOCKERHUB_USERNAME }}/sugarfunge-api:amd64-latest | |
- name: Run Docker Image | |
run: docker run --rm -d --name sugarfunge_api_test ${{ secrets.DOCKERHUB_USERNAME }}/sugarfunge-api:amd64-latest | |
- name: Check if Docker Container is Running | |
run: | | |
if docker ps | grep -q sugarfunge_api_test; then | |
echo "Container is running successfully." | |
else | |
echo "Error: Container failed to start." | |
exit 1 | |
fi | |
- name: Stop Docker Container | |
if: always() | |
run: docker stop sugarfunge_api_test |