64 lines
2.2 KiB
YAML
64 lines
2.2 KiB
YAML
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 Fetch
|
|
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
|
|
install_node=true
|
|
apt-get remove nodejs npm
|
|
fi
|
|
fi
|
|
|
|
if $install_node; then
|
|
apt-get install -y curl
|
|
curl -fsSL https://deb.nodesource.com/setup_24.x | bash
|
|
apt-get install -y -q nodejs
|
|
fi
|
|
|
|
package='node-fetch@2'
|
|
if [ `npm list -g | grep -c $package` -eq 0 ]; then
|
|
npm install $package --no-shrinkwrap
|
|
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
|