diff --git a/.github/workflows/archlinuxarm-armv7-docker.yml b/.github/workflows/archlinuxarm-armv7-docker.yml deleted file mode 100644 index 24c3cbc..0000000 --- a/.github/workflows/archlinuxarm-armv7-docker.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Archlinuxarm armv7 docker -on: - push: - branches: [ master ] - schedule: - # once a week - - cron: '0 0 * * 1' -jobs: - - build: - name: Push archlinuxarm-armv7 image to docker registry - runs-on: ubuntu-latest - steps: - - name: Set up Go 1.21 - uses: actions/setup-go@v5.0.0 - with: - go-version: '1.21' - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v4.1.1 - - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - - name: Fetch additional packages - run: | - sudo apt-get update - sudo apt-get install fdisk gdisk qemu-user-static libarchive-tools tar - - - name: Build - run: go build -v . - - - name: Install Packer - uses: hashicorp-contrib/setup-packer@v3 - with: - packer-version: 1.10.0 - - - name: Install packer plugins - run: sudo packer init boards/armv7/archlinuxarm-docker.pkr.hcl - - - name: Build image - run: | - sudo packer build \ - -var docker_user=$docker_user \ - -var docker_password=$docker_password \ - -var docker_repository=$docker_repository \ - boards/armv7/archlinuxarm-docker.pkr.hcl - env: - docker_user: ${{ secrets.docker_user }} - docker_password: ${{ secrets.docker_password }} - docker_repository: mkaczanowski/archlinuxarm diff --git a/.github/workflows/archlinuxarm-armv8-docker.yml b/.github/workflows/archlinuxarm-armv8-docker.yml deleted file mode 100644 index efacd52..0000000 --- a/.github/workflows/archlinuxarm-armv8-docker.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Archlinuxarm armv8 docker -on: - push: - branches: [ master ] - schedule: - # once a week - - cron: '0 0 * * 1' -jobs: - - build: - name: Push archlinuxarm-armv7 image to docker registry - runs-on: ubuntu-latest - steps: - - name: Set up Go 1.21 - uses: actions/setup-go@v5.0.0 - with: - go-version: '1.21' - id: go - - - name: Check out code into the Go module directory - uses: actions/checkout@v4.1.1 - - - name: Get dependencies - run: | - go get -v -t -d ./... - if [ -f Gopkg.toml ]; then - curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh - dep ensure - fi - - - name: Fetch additional packages - run: | - sudo apt-get update - sudo apt-get install fdisk gdisk qemu-user-static libarchive-tools tar - - - name: Build - run: go build -v . - - - name: Install Packer - uses: hashicorp-contrib/setup-packer@v3 - with: - packer-version: 1.10.0 - - - name: Install packer plugins - run: sudo packer init boards/armv8/archlinuxarm-docker.pkr.hcl - - - name: Build image - run: | - sudo packer build \ - -var docker_user=$docker_user \ - -var docker_password=$docker_password \ - -var docker_repository=$docker_repository \ - boards/armv8/archlinuxarm-docker.pkr.hcl - env: - docker_user: ${{ secrets.docker_user }} - docker_password: ${{ secrets.docker_password }} - docker_repository: mkaczanowski/archlinuxarm diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b5f5db3..6aa78c1 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,6 +15,10 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: docker: runs-on: ubuntu-latest @@ -34,27 +38,27 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - #- name: Docker meta - # id: meta - # uses: docker/metadata-action@v5 - # with: - # images: | - # mkaczanowski/packer-builder-arm - # tags: | - # type=ref,event=branch - # type=ref,event=pr - # type=match,pattern=v(.*),group=1 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=match,pattern=v(.*),group=1 - #### build+export, test only on PRs - #- name: Build and export to Docker - # if: github.event_name == 'pull_request' - # uses: docker/build-push-action@v5 - # with: - # context: . - # file: docker/Dockerfile - # load: true - # tags: packer-plugin-cross:test - # labels: ${{ steps.meta.outputs.labels }} + ### build+export, test only on PRs + - name: Build and export to Docker + if: github.event_name == 'pull_request' + uses: docker/build-push-action@v5 + with: + context: . + file: docker/Dockerfile + load: true + tags: packer-plugin-cross:test + labels: ${{ steps.meta.outputs.labels }} - name: Install packer plugins if: github.event_name == 'pull_request' @@ -69,36 +73,20 @@ jobs: du -h --apparent-size raspberry-pi-4.img #### - # - name: Login to DockerHub - # uses: docker/login-action@v3 - # if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') - # with: - # username: ${{ secrets.DOCKER_USER }} - # password: ${{ secrets.DOCKER_PASSWORD }} - - # - name: Login to GitHub Container Registry - # uses: docker/login-action@v3 - # with: - # registry: ghcr.io - # username: ${{ github.repository_owner }} - # password: ${{ secrets.GHCR_IO_REGISTRY_TOKEN }} - - #- name: Build and push - # uses: docker/build-push-action@v5 - # if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }} - # with: - # context: . - # file: docker/Dockerfile - # platforms: linux/amd64,linux/arm64 - # push: true - # tags: ${{ steps.meta.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - #- name: Update description - # uses: peter-evans/dockerhub-description@v3 - # if: github.ref == 'refs/heads/master' - # with: - # username: ${{ secrets.DOCKER_USER }} - # password: ${{ secrets.DOCKER_PASSWORD }} - # short-description: Packer plugin to build ARM images - # readme-filepath: ./README.md + - name: Build and push + uses: docker/build-push-action@v5 + if: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags') }} + with: + context: . + file: docker/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/boards/armv7/alpine.json b/boards/armv7/alpine.json deleted file mode 100644 index 42a8d28..0000000 --- a/boards/armv7/alpine.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "variables": {}, - "builders": [{ - "type": "cross", - "file_urls" : ["http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/armhf/alpine-minirootfs-3.12.0-armhf.tar.gz"], - "file_checksum_url": "http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/armhf/alpine-minirootfs-3.12.0-armhf.tar.gz.sha256", - "file_checksum_type": "sha256", - "file_unarchive_cmd": ["bsdtar", "-xpf", "$ARCHIVE_PATH", "-C", "$MOUNTPOINT"], - "file_target_extension": "tar.gz", - "image_build_method": "new", - "image_path": "alpine.img", - "image_size": "4G", - "image_type": "dos", - "image_partitions": [ - { - "name": "root", - "type": "83", - "start_sector": "4096", - "filesystem": "ext4", - "size": "0", - "mountpoint": "/" - } - ], - "qemu_binary_source_path": "/usr/bin/qemu-arm-static", - "qemu_binary_destination_path": "/usr/bin/qemu-arm-static", - "image_chroot_env": ["PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/sbin:/usr/sbin"] - }], - "provisioners": [ - { - "type": "shell", - "inline": [ - "echo 'nameserver 8.8.8.8' > /etc/resolv.conf", - "apk update" - ] - } - ], - "post-processors": [] -} diff --git a/boards/armv7/archlinuxarm-docker.pkr.hcl b/boards/armv7/archlinuxarm-docker.pkr.hcl deleted file mode 100644 index eda5aa2..0000000 --- a/boards/armv7/archlinuxarm-docker.pkr.hcl +++ /dev/null @@ -1,76 +0,0 @@ -# See https://www.packer.io/docs/templates/hcl_templates/blocks/packer for more info -packer { - required_plugins { - docker = { - source = "github.com/hashicorp/docker" - version = "~> 1" - } - } -} - -variable "docker_password" { - type = string - default = "" -} - -variable "docker_repository" { - type = string - default = "" -} - -variable "docker_user" { - type = string - default = "" -} - -# https://www.packer.io/docs/templates/hcl_templates/blocks/source -source "cross" "autogenerated_1" { - file_checksum_type = "md5" - file_checksum_url = "http://hu.mirror.archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz.md5" - file_target_extension = "tar.gz" - file_unarchive_cmd = ["bsdtar", "-xpf", "$ARCHIVE_PATH", "-C", "$MOUNTPOINT"] - file_urls = ["http://hu.mirror.archlinuxarm.org/os/ArchLinuxARM-armv7-latest.tar.gz"] - image_build_method = "new" - image_partitions { - filesystem = "ext4" - mountpoint = "/" - name = "root" - size = "0" - start_sector = "4096" - type = "83" - } - image_path = "armv7.tar.gz" - image_size = "2G" - image_type = "dos" - qemu_binary_destination_path = "/usr/bin/qemu-arm-static" - qemu_binary_source_path = "/usr/bin/qemu-arm-static" -} - -# https://www.packer.io/docs/templates/hcl_templates/blocks/build -build { - sources = ["source.cross.autogenerated_1"] - - provisioner "shell" { - inline = [ - "pacman-key --init", - "pacman-key --populate archlinuxarm", - "echo 'Server = http://nl.mirror.archlinuxarm.org/$arch/$repo' >> /etc/pacman.d/mirrorlist" - ] - } - - post-processors { - post-processor "artifice" { - files = ["armv7.tar.gz"] - } - post-processor "docker-import" { - platform = "linux/arm/v7" - repository = "${var.docker_repository}" - tag = "armv7" - } - post-processor "docker-push" { - login = true - login_password = "${var.docker_password}" - login_username = "${var.docker_user}" - } - } -} diff --git a/boards/armv8/archlinuxarm-docker.pkr.hcl b/boards/armv8/archlinuxarm-docker.pkr.hcl deleted file mode 100644 index 15c264d..0000000 --- a/boards/armv8/archlinuxarm-docker.pkr.hcl +++ /dev/null @@ -1,79 +0,0 @@ -# See https://www.packer.io/docs/templates/hcl_templates/blocks/packer for more info -packer { - required_plugins { - docker = { - source = "github.com/hashicorp/docker" - version = "~> 1" - } - } -} - -# https://www.packer.io/docs/templates/hcl_templates/variables#type-constraints for more info. -variable "docker_password" { - type = string - default = "" -} - -variable "docker_repository" { - type = string - default = "" -} - -variable "docker_user" { - type = string - default = "" -} - -# https://www.packer.io/docs/templates/hcl_templates/blocks/source -source "cross" "autogenerated_1" { - file_checksum_type = "md5" - file_checksum_url = "http://hu.mirror.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz.md5" - file_target_extension = "tar.gz" - file_unarchive_cmd = ["bsdtar", "-xpf", "$ARCHIVE_PATH", "-C", "$MOUNTPOINT"] - file_urls = ["http://hu.mirror.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz"] - image_build_method = "new" - image_partitions { - filesystem = "ext4" - mountpoint = "/" - name = "root" - size = "0" - start_sector = "4096" - type = "83" - } - image_path = "armv8.tar.gz" - image_size = "2G" - image_type = "dos" - qemu_binary_destination_path = "/usr/bin/qemu-aarch64-static" - qemu_binary_source_path = "/usr/bin/qemu-aarch64-static" -} - -# a build block invokes sources and runs provisioning steps on them. The -# documentation for build blocks can be found here: -# https://www.packer.io/docs/templates/hcl_templates/blocks/build -build { - sources = ["source.cross.autogenerated_1"] - - provisioner "shell" { - inline = [ - "pacman-key --init", - "pacman-key --populate archlinuxarm", - "echo 'Server = http://nl.mirror.archlinuxarm.org/$arch/$repo' >> /etc/pacman.d/mirrorlist" - ] - } - - post-processors { - post-processor "artifice" { - files = ["armv8.tar.gz"] - } - post-processor "docker-import" { - platform = "linux/arm64" - repository = "${var.docker_repository}" - tag = "armv8" - } - post-processor "docker-push" { - login = true - login_password = "${var.docker_password}" - login_username = "${var.docker_user}" - } - } -}