Merge pull request #1 from JamesJonesConsulting/develop
Some checks failed
Build podman-dind-like / build-and-push (push) Has been cancelled
Some checks failed
Build podman-dind-like / build-and-push (push) Has been cancelled
Bringing in the Github Actions build and publish to Github's ghcr.io docker registry
This commit is contained in:
70
.github/workflows/build.yml
vendored
70
.github/workflows/build.yml
vendored
@@ -3,20 +3,22 @@ name: Build podman-dind-like
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- release/*
|
||||
- feature/*
|
||||
- 'release/**'
|
||||
- 'feature/**'
|
||||
- develop
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'release/**'
|
||||
- develop
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-and-push:
|
||||
runs-on: self-hosted
|
||||
container:
|
||||
image: quay.io/podman/stable:latest
|
||||
@@ -34,33 +36,33 @@ jobs:
|
||||
login-server: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
- name: Build and push Docker images
|
||||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
# - name: Build the Docker image
|
||||
# run: |
|
||||
# if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
||||
# VERSION=$GITHUB_REF_NAME
|
||||
# else
|
||||
# VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's|/|-|g')
|
||||
# fi
|
||||
# podman build . --file Dockerfile --tag "ghcr.io/$IMAGE_NAME:$VERSION"
|
||||
# echo $REG_TOKEN | podman login ghcr.io -u ${GITHUB_ACTOR} --password-stdin
|
||||
# podman push "ghcr.io/$IMAGE_NAME:$VERSION"
|
||||
# if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
||||
# podman tag "ghcr.io/$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"
|
||||
# podman push "ghcr.io/$IMAGE_NAME:latest"
|
||||
# fi
|
||||
# env:
|
||||
# REG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# # REG_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
|
||||
# IMAGE_NAME: jamesjonesconsulting/podman-dind-like
|
||||
# This requires docker buildx which podman doesn't support
|
||||
# - name: Extract metadata (tags, labels) for Docker
|
||||
# id: meta
|
||||
# uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||
# with:
|
||||
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
# - name: Build and push Docker images
|
||||
# uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||
# with:
|
||||
# context: .
|
||||
# push: true
|
||||
# tags: ${{ steps.meta.outputs.tags }}
|
||||
# labels: ${{ steps.meta.outputs.labels }}
|
||||
- name: Build the Docker image
|
||||
run: |
|
||||
IMAGE_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
||||
VERSION=$GITHUB_REF_NAME
|
||||
else
|
||||
VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's|/|-|g')
|
||||
fi
|
||||
podman build . --file Dockerfile --tag "$REGISTRY/$IMAGE_NAME:$VERSION"
|
||||
podman push "$REGISTRY/$IMAGE_NAME:$VERSION"
|
||||
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
||||
podman tag "$REGISTRY/$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"
|
||||
podman push "$REGISTRY/$IMAGE_NAME:latest"
|
||||
fi
|
||||
# env:
|
||||
# REG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
# # REG_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
|
||||
|
||||
15
README.md
15
README.md
@@ -7,9 +7,20 @@ A Docker-in-Docker like container using Podman
|
||||
This takes the quay.io/podman/stable image and extends it with some enhancements to make it more docker like
|
||||
and able to use `docker` as a command as well as includes `docker-compose`.
|
||||
|
||||
## Notes
|
||||
## Notes on Github Actions
|
||||
|
||||
This job runs on a self-hosted gitlab agent with the following in the `/etc/gitlab-runner/config.toml` file so this is also compatible with
|
||||
This job runs on a self-hosted Github Actions agent and publishes to Github's container registry ghcr.io as a 'public' image and can be downloaded
|
||||
via a simple docker command or other means as you see fit.
|
||||
|
||||
Note: The `build-push` action doesn't work with 'podman' (commented out in the pipeline) as it tightly coupled with 'buildx' which is only supported with native docker.
|
||||
|
||||
```
|
||||
docker pull ghcr.io/jamesjonesconsulting/podman-dind-like:latest
|
||||
```
|
||||
|
||||
## Notes on GitLab
|
||||
|
||||
This job also runs on a self-hosted gitlab agent with the following in the `/etc/gitlab-runner/config.toml` file so this is also compatible with
|
||||
other self-hosted agents for other CI/CD self-hosted agents.
|
||||
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user