VyOS Build Container Image and Push to Docker Hub #239
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: "VyOS Build Container Image and Push to Docker Hub" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 3 * * *" | |
jobs: | |
build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download VyOS ISO | |
run: | | |
chmod +x ./script/download-vyos-latest-image.sh | |
./script/download-vyos-latest-image.sh | |
- name: Build Container Image | |
run: | | |
chmod +x ./script/build-container-image.sh | |
sudo ./script/build-container-image.sh | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Import the contents from a tarball to create a filesystem image | |
env: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
repository: ${{ secrets.DOCKER_REPOSITORY }} | |
run: | | |
sudo tar -C unsquashfs -c . | docker import - $username/$repository:${{ env.tag_name }} --change 'CMD ["/sbin/init"]' | |
- name: Push Container Image to Docker Hub | |
env: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
repository: ${{ secrets.DOCKER_REPOSITORY }} | |
run: | | |
docker push $username/$repository:${{ env.tag_name }} | |
docker tag $username/$repository:${{ env.tag_name }} $username/$repository:latest | |
docker push $username/$repository:latest |