name: 'Build docker container' on: push: tags: - '*' workflow_dispatch: jobs: build: runs-on: ubuntu-latest defaults: run: working-directory: ${{ GITHUB_WORKSPACE }} steps: - name: Checkout uses: actions/checkout@v4 - name: Install Docker run: | echo "Checking docker installation" if command -v docker &> /dev/null; then echo "Docker installation found" else echo "Docker installation not found. Docker will be installed" curl -fsSL https://get.docker.com | sh fi - name: Install npm dependencies run: | echo "Installing fetch" install_node=$false if ! command -v node &> /dev/null; then install_node=true else node_version=$(node -v) node_version=${node_version:1} # Remove 'v' at the beginning node_version=${node_version%\.*} # Remove trailing ".*". node_version=${node_version%\.*} # Remove trailing ".*". node_version=$(($node_version)) # Convert the NodeJS version number from a string to an integer. if [ $node_version -lt 24 ]; then echo $"removing outdated npm version" install_node=true apt-get remove nodejs npm fi fi if $install_node; then echo $"Installing node 24" apt-get install -y curl curl -fsSL https://deb.nodesource.com/setup_24.x | bash apt-get install -y -q nodejs fi echo $(npm list -g | grep -c @actions/core) echo $(npm list -g | grep -c node-fetch) # package='undici' package='node-fetch' if [ `npm list -g | grep -c $package` -eq 0 ]; then npm install -g $package fi - name: Login to DockerHub container registry uses: https://github.com/docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} - name: Docker Hub Description uses: peter-evans/dockerhub-description@v5 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} repository: davidquinonescl/hyperion-docker