Skip to content

Commit

Permalink
Added container image
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed Oct 20, 2024
1 parent 3e8cd8c commit 2c03aa8
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,64 @@ jobs:
--build-arg ACTIONS_ID_TOKEN_REQUEST_TOKEN \
--build-arg GITHUB_REF_NAME \
.
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: uniget-bot
password: ${{ secrets.GITHUB_TOKEN }}

- name: Install uniget
uses: uniget-org/uniget-action@v1
with:
prefix: helper
tools: jq regclient

- name: Build container image
run: |
case "$( uname -m )" in
x86_64)
ARCH=amd64
;;
aarch64)
ARCH=arm64
;;
*)
echo "Unsupported architecture: $( uname -m )"
exit 1
;;
esac
UNIGET_PATH="$(
./helper/usr/local/bin/jq --raw-output --arg arch "${ARCH}" '.[] | select(.goarch == $arch) | .path' dist/artifacts.json \
| cut -d/ -f-2
)"
mv "${UNIGET_PATH}" "dist/default_linux_${ARCH}"
VERSION="$(
"dist/default_linux_${ARCH}/uniget" --version \
| cut -d' ' -f3
)"
docker build . \
--target systemd-uniget \
--platform linux/amd64,linux/arm64 \
--build-arg version="${VERSION}" \
--tag ghcr.io/uniget-org/uniget:${VERSION} \
--push
LATEST_VERSION="$(
./helper/usr/local/bin/regctl tag list ghcr.io/uniget-org/cli \
| grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' \
| sort -Vr \
| head -n 1
)"
./helper/usr/local/bin/regctl image copy \
"ghcr.io/uniget-org/uniget:${VERSION}" \
"ghcr.io/uniget-org/uniget:${LATEST_VERSION}"
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,11 @@ COPY --from=bin /uniget /uniget
ENTRYPOINT [ "/uniget"]

FROM ghcr.io/uniget-org/images/systemd:ubuntu24.04 AS systemd-uniget
COPY --from=bin /uniget /usr/local/bin/uniget
ARG version
ARG TARGETARCH
COPY dist/default_linux_${TARGETARCH}/uniget /usr/local/bin/uniget
LABEL \
org.opencontainers.image.source="https://github.com/uniget-org/cli" \
org.opencontainers.image.title="uniget" \
org.opencontainers.image.description="The universal installer and updater for (container) tools" \
org.opencontainers.image.version="${version}"

0 comments on commit 2c03aa8

Please sign in to comment.