-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add - multi architecture builds x64 & arm64
* add - multi architecture builds x64 & arm64
- Loading branch information
Showing
5 changed files
with
134 additions
and
28 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Docker Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
|
||
jobs: | ||
docker-build: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
REPO: ${{ github.event.repository.name }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up QEM | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push ubuntu 22.04 | ||
uses: docker/build-push-action@v6 | ||
with: | ||
file: Dockerfile | ||
platforms: linux/amd64,linux/arm64 | ||
build-arg: UBUNTU_VERSION=22.04 | ||
push: false | ||
tags: chaddyc/${{ github.event.repository.name }}:22.04 | ||
|
||
- name: Build and push ubuntu 24.04 | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
build-arg: UBUNTU_VERSION=24.04 | ||
push: false | ||
tags: chaddyc/${{ github.event.repository.name }}:24.04 | ||
|
||
- name: Build and push ubuntu latest | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
build-arg: UBUNTU_VERSION=latest | ||
push: false | ||
tags: chaddyc/${{ github.event.repository.name }}:latest | ||
|
||
- name: Update docker readme description | ||
uses: peter-evans/dockerhub-description@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: chaddyc/${{ github.event.repository.name }} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
ARG UBUNTU_VERSION=20.04 | ||
FROM ubuntu:${UBUNTU_VERSION} | ||
LABEL org.opencontainers.image.authors="https://github.com/chaddyc" | ||
|
||
ARG TARGETARCH | ||
RUN echo "Detected architecture: ${TARGETARCH}" | ||
|
||
ENV RUNNER_ARCH=${RUNNER_ARCH} | ||
Check warning on line 8 in Dockerfile GitHub Actions / docker-buildVariables should be defined before their use
Check warning on line 8 in Dockerfile GitHub Actions / docker-buildVariables should be defined before their use
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
jq \ | ||
git \ | ||
tar \ | ||
sudo \ | ||
software-properties-common && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /runner | ||
|
||
RUN LATEST_RUNNER_VERSION=$(curl -s https://api.github.com/repos/actions/runner/releases/latest | jq -r .tag_name) && \ | ||
RUNNER_VERSION_NUMBER=$(echo "$LATEST_RUNNER_VERSION" | sed 's/^v//') && \ | ||
if [ "${TARGETARCH}" = "amd64" ]; then \ | ||
export RUNNER_ARCH="x64"; \ | ||
elif [ "${TARGETARCH}" = "arm64" ]; then \ | ||
export RUNNER_ARCH="arm64"; \ | ||
else \ | ||
echo "Unsupported architecture: ${TARGETARCH}"; exit 1; \ | ||
fi && \ | ||
echo "Downloading https://github.com/actions/runner/releases/download/$LATEST_RUNNER_VERSION/actions-runner-linux-$RUNNER_ARCH-$RUNNER_VERSION_NUMBER.tar.gz" && \ | ||
curl -L -o actions-runner.tar.gz https://github.com/actions/runner/releases/download/$LATEST_RUNNER_VERSION/actions-runner-linux-$RUNNER_ARCH-$RUNNER_VERSION_NUMBER.tar.gz && \ | ||
tar xzf actions-runner.tar.gz && \ | ||
rm -f actions-runner.tar.gz | ||
|
||
RUN ./bin/installdependencies.sh | ||
|
||
RUN useradd -m -s /bin/bash runner && \ | ||
echo "runner ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers | ||
|
||
RUN chown -R runner:runner /runner | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
USER runner | ||
WORKDIR /runner | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
File renamed without changes.
File renamed without changes.