Skip to content

Commit

Permalink
add fedora support
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Yuan <[email protected]>
  • Loading branch information
SamYuan1990 committed Apr 4, 2024
1 parent 5387734 commit ba01f8d
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 15 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@ jobs:
needs:
- shellcheck
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- OS: ubuntu
- OS: fedora
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -104,9 +110,9 @@ jobs:
uses: docker/build-push-action@v5
with:
context: .
file: ./test/ubuntu.Dockerfile
file: ./test/${{matrix.OS}}.Dockerfile
platforms: linux/amd64
#,linux/arm64,linux/s390x later
push: false
tags: ubuntutest:latest
tags: testcontainer:latest

33 changes: 20 additions & 13 deletions main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,19 +142,26 @@ ebpf() {
}

containerruntime() {
# Add Docker's official GPG key:
sudo apt-get update -y
sudo apt-get install ca-certificates curl gnupg -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
isUbuntu=$(cat /etc/os-release | grep NAME | grep Ubuntu | wc -l)
if [ $isUbuntu -gt 0 ]; then
# Add Docker's official GPG key:
sudo apt-get update -y
sudo apt-get install ca-certificates curl gnupg -y
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update -y
apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
else
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo
sudo dnf install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
fi
}

main() {
Expand Down
8 changes: 8 additions & 0 deletions test/fedora.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
From fedora

WORKDIR /workspace

COPY . .
RUN yum update -y && yum install -y git sudo
RUN ./main.sh containerruntime
RUN ./verify.sh containerruntime

0 comments on commit ba01f8d

Please sign in to comment.