Skip to content

Commit

Permalink
Another attempt at building a valid ARM Docker image
Browse files Browse the repository at this point in the history
* Switches to `debian:bullseye` as the base image for the `final` stage
* Pushes test image to GitHub packages repository and tests it from there. This is an attempt to determine if the `load: true` is causing problems with the way the ARM image is being built.
  • Loading branch information
mscottford committed Sep 25, 2023
1 parent 465ffe0 commit 6b5e028
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 27 deletions.
55 changes: 29 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,45 +268,48 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: "[Publish, Docker] - Build"
- name: "[Publish, Docker] - Login to GitHub Container Registry"
if: ${{ startsWith(github.ref, 'refs/tags/v') && runner.os != 'Windows' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "[Publish, Docker] - Build, Push to GitHub Container Registry"
if: ${{ startsWith(github.ref, 'refs/tags/v') && runner.os != 'Windows' }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
load: true
platforms: linux/amd64,linux/arm64
push: true
tags:
corgibytes/freshli-cli:latest,
corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }},
corgibytes/freshli-cli:${{ steps.gitversion.outputs.semVer }}-${{ steps.gitversion.outputs.fullBuildMetadata }}
cache-from: type=registry,ref=corgibytes/freshli-cli:buildcache
cache-to: type=registry,ref=corgibytes/freshli-cli:buildcache,mode=max
ghcr.io/corgibytes/freshli-cli:latest,
ghcr.io/corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }},
ghcr.io/corgibytes/freshli-cli:${{ steps.gitversion.outputs.semVer }}-${{ steps.gitversion.outputs.fullBuildMetadata }}
cache-from: type=registry,ref=ghcr.io/corgibytes/freshli-cli:buildcache
cache-to: type=registry,ref=ghcr.io/corgibytes/freshli-cli:buildcache,mode=max

- name: "[Publish, Docker] - Smoke Test - `agents detect`"
- name: "[Publish, Docker] - Smoke Test - `agents detect` via GitHub Container Registry image"
if: ${{ startsWith(github.ref, 'refs/tags/v') && runner.os != 'Windows' }}
run: |
docker run --rm corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }} agents detect
docker run --rm ghcr.io/corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }} agents detect
- name: "[Publish, Docker] - Smoke Test - Analyze Java Fixture Repo"
- name: "[Publish, Docker] - Smoke Test - Analyze Java Fixture Repo via GitHub Container Registry image"
if: ${{ startsWith(github.ref, 'refs/tags/v') && runner.os != 'Windows' }}
run: |
docker run --rm corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }} analyze https://github.com/corgibytes/freshli-fixture-java-test
docker run --rm ghcr.io/corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }} analyze https://github.com/corgibytes/freshli-fixture-java-test
- name: "[Publish, Docker] - Smoke Test - Analyze DotNet Fixture Repo"
- name: "[Publish, Docker] - Smoke Test - Analyze DotNet Fixture Repo via GitHub Container Registry image"
if: ${{ startsWith(github.ref, 'refs/tags/v') && runner.os != 'Windows' }}
run: |
docker run --rm corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }} analyze https://github.com/corgibytes/freshli-fixture-csharp-test
docker run --rm ghcr.io/corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }} analyze https://github.com/corgibytes/freshli-fixture-csharp-test
- name: "[Publish, Docker] - Push"
- name: "[Publish, Docker] - Push to Docker Hub"
if: ${{ startsWith(github.ref, 'refs/tags/v') && runner.os != 'Windows' }}
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags:
corgibytes/freshli-cli:latest,
corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }},
corgibytes/freshli-cli:${{ steps.gitversion.outputs.semVer }}-${{ steps.gitversion.outputs.fullBuildMetadata }}
cache-from: type=registry,ref=corgibytes/freshli-cli:buildcache
cache-to: type=registry,ref=corgibytes/freshli-cli:buildcache,mode=max
run: |
docker buildx imagetools create \
--tag corgibytes/freshli-cli:latest,
--tag corgibytes/freshli-cli:${{ steps.gitversion.outputs.majorMinorPatch }},
--tag corgibytes/freshli-cli:${{ steps.gitversion.outputs.semVer }}-${{ steps.gitversion.outputs.fullBuildMetadata }}
ghcr.io/corgibytes/freshli-cli:latest
13 changes: 12 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ RUN ./gradlew installDist

### Runtime container
# Use .NET SDK as the base image, because it is required by the dotnet agent
FROM dotnet_build_platform_specific AS final
FROM debian:bullseye AS final

# Install dependencies
RUN apt update -y && apt install -y curl gnupg2 ca-certificates

# Install Java JDK
RUN apt update -y && apt install -y wget apt-transport-https
Expand All @@ -75,6 +78,14 @@ RUN wget -O - https://packages.adoptium.net/artifactory/api/gpg/key/public | tee
RUN echo "deb [signed-by=/etc/apt/keyrings/adoptium.asc] https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | tee /etc/apt/sources.list.d/adoptium.list
RUN apt update -y && apt-get install temurin-17-jdk -y

# Install dotnet SDK
WORKDIR /tmp
RUN wget https://dot.net/v1/dotnet-install.sh
RUN chmod +x dotnet-install.sh
RUN ./dotnet-install.sh --install-dir /usr/local/share/dotnet-sdk --os linux --channel 7.0
RUN ln -s /usr/local/share/dotnet-sdk/dotnet /usr/local/bin/dotnet
ENV DOTNET_ROOT=/usr/local/share/dotnet-sdk

# Install git
RUN apt update -y && apt install git lsof -y

Expand Down

0 comments on commit 6b5e028

Please sign in to comment.