Skip to content

Commit

Permalink
Integrade ARM support
Browse files Browse the repository at this point in the history
  • Loading branch information
Nguyen Hoan Tien committed Oct 30, 2023
1 parent 94dc8a5 commit 02a6df6
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 20 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,29 @@ jobs:
- name: Checkout Code
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Install regctl
uses: iarekylew00t/regctl-installer@v1
with:
regctl-release: v0.5.3

- name: Login to Artifactory
run: |
docker login -u ${{ secrets.ARTIFACTORY_USER }} -p ${{ secrets.ARTIFACTORY_PASSWORD }} "$ARTIFACTORY_URL"
- name: Publish Docker Image
- name: Publish The Version Docker Image
id: publish_image
run: |
ARMORY_TOOLS_VERSION="$(python3 -c 'import sys; print(sys.argv[1].split("/")[2])' $GITHUB_REF)-$GITHUB_SHA"
ARMORY_IMAGE_NAME="$ARTIFACTORY_URL/armory-io/docker-debugging-tools:$ARMORY_TOOLS_VERSION"
ARMORY_IMAGE_NAME_LATEST="$ARTIFACTORY_URL/armory-io/docker-debugging-tools:latest"
docker build -t "$ARMORY_IMAGE_NAME" ./docker-debugging-tools/
docker tag "$ARMORY_IMAGE_NAME" "$ARMORY_IMAGE_NAME_LATEST"
docker buildx build --push --platform linux/arm64,linux/amd64 -t "$ARMORY_IMAGE_NAME" ./docker-debugging-tools/
echo "version_image=$ARMORY_IMAGE_NAME" >> $GITHUB_OUTPUT
docker push "$ARMORY_IMAGE_NAME"
docker push "$ARMORY_IMAGE_NAME_LATEST"
- name: Re-Tagging Docker Image Version
run: |
regctl image copy ${{ steps.publish_image.outputs.version_image }} ${{ env.ARTIFACTORY_URL }}/armory-io/docker-debugging-tools:latest
12 changes: 10 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,18 @@ jobs:
GITHUB_REF: '${{ github.ref }}'
steps:
- uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Docker Login
run: docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASS }}"

- name: Build Debugging Tools Container
run: |
export DOCKER_TAG="${GITHUB_REF##*/}"
cd docker-debugging-tools
./bin/build.sh
docker login -u "${{ secrets.DOCKER_HUB_USER }}" -p "${{ secrets.DOCKER_HUB_PASS }}"
./bin/push.sh
20 changes: 11 additions & 9 deletions docker-debugging-tools/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM alpine:3
FROM --platform=$TARGETPLATFORM alpine:3
MAINTAINER Armory <eng@armory.io>

ENV KUBECTL_RELEASE=1.26.2
ARG TARGETARCH

ENV KUBECTL_RELEASE=1.27.3
ENV AWS_IAM_AUTHENTICATOR_VERSION=0.6.2
ENV JQ_VERSION=1.6-r2
ENV AWS_CLI_VERSION=1.27.87
Expand All @@ -27,20 +29,20 @@ RUN apk update && apk add --no-cache \
&& rm -rf /var/cache/apk/*

# install kubectl, latest version can be found here: https://storage.googleapis.com/kubernetes-release/release/stable.txt
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_RELEASE}/bin/linux/amd64/kubectl \
&& chmod +x ./kubectl \
&& mv ./kubectl /usr/local/bin/kubectl \
&& ln -sv /usr/local/bin/kubectl /usr/local/bin/k \
&& ln -sv /usr/local/bin/kubectl /usr/local/bin/kub
RUN wget https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_RELEASE}/bin/linux/${TARGETARCH}/kubectl \
&& chmod +x kubectl \
&& mv ./kubectl /usr/local/bin/kubectl \
&& ln -sv /usr/local/bin/kubectl /usr/local/bin/k \
&& ln -sv /usr/local/bin/kubectl /usr/local/bin/kub

# install aws-iam-authenticator, latest version can be found here: https://github.com/kubernetes-sigs/aws-iam-authenticator/releases
# note: for EKS you can also use `aws eks get-token` now, see https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html
RUN curl -Lo aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_IAM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${AWS_IAM_AUTHENTICATOR_VERSION}_linux_amd64 \
RUN curl -Lo aws-iam-authenticator https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_IAM_AUTHENTICATOR_VERSION}/aws-iam-authenticator_${AWS_IAM_AUTHENTICATOR_VERSION}_linux_${TARGETARCH} \
&& chmod +x ./aws-iam-authenticator \
&& mv ./aws-iam-authenticator /usr/local/bin/aws-iam-authenticator

# install vault, latest version can be found here: https://www.vaultproject.io/downloads.html
RUN curl -O https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_amd64.zip \
RUN curl -O https://releases.hashicorp.com/vault/${VAULT_VERSION}/vault_${VAULT_VERSION}_linux_${TARGETARCH}.zip \
&& unzip vault* \
&& mv vault /usr/bin/ \
&& rm -rf vault*
Expand Down
2 changes: 1 addition & 1 deletion docker-debugging-tools/Dockerfile-sshd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# To login to the SSH server, put a public key (id_rsa.pub) in /root/.ssh/authorized_keys
#
FROM alpine:3.5
FROM alpine:3.7

RUN apk --update add --no-cache openssh bash curl

Expand Down
4 changes: 2 additions & 2 deletions docker-debugging-tools/bin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
cd "$(dirname "$0")/.."

source bin/env
docker build -t "${DOCKER_IMAGE}" .
docker build -t "${DOCKER_SSH_IMAGE}" -f Dockerfile-sshd .
docker buildx build --push --platform linux/arm64,linux/amd64 -t "${DOCKER_IMAGE}" .
docker buildx build --push --platform linux/arm64,linux/amd64 -t "${DOCKER_SSH_IMAGE}" -f Dockerfile-sshd .

0 comments on commit 02a6df6

Please sign in to comment.