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:
64
.github/workflows/build.yml
vendored
64
.github/workflows/build.yml
vendored
@@ -3,20 +3,22 @@ name: Build podman-dind-like
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- release/*
|
- 'release/**'
|
||||||
- feature/*
|
- 'feature/**'
|
||||||
- develop
|
- develop
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
- 'release/**'
|
||||||
- develop
|
- develop
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
IMAGE_NAME: ${{ github.repository }}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-and-push:
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
container:
|
container:
|
||||||
image: quay.io/podman/stable:latest
|
image: quay.io/podman/stable:latest
|
||||||
@@ -34,33 +36,33 @@ jobs:
|
|||||||
login-server: ${{ env.REGISTRY }}
|
login-server: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
# This requires docker buildx which podman doesn't support
|
||||||
id: meta
|
# - name: Extract metadata (tags, labels) for Docker
|
||||||
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
# id: meta
|
||||||
with:
|
# uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
||||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
# with:
|
||||||
- name: Build and push Docker images
|
# images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
# - name: Build and push Docker images
|
||||||
with:
|
# uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
|
||||||
context: .
|
# with:
|
||||||
push: true
|
# context: .
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
# push: true
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
# tags: ${{ steps.meta.outputs.tags }}
|
||||||
# - name: Build the Docker image
|
# labels: ${{ steps.meta.outputs.labels }}
|
||||||
# run: |
|
- name: Build the Docker image
|
||||||
# if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
run: |
|
||||||
# VERSION=$GITHUB_REF_NAME
|
IMAGE_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
|
||||||
# else
|
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
||||||
# VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's|/|-|g')
|
VERSION=$GITHUB_REF_NAME
|
||||||
# fi
|
else
|
||||||
# podman build . --file Dockerfile --tag "ghcr.io/$IMAGE_NAME:$VERSION"
|
VERSION=$(echo "${GITHUB_REF_NAME}" | sed 's|/|-|g')
|
||||||
# echo $REG_TOKEN | podman login ghcr.io -u ${GITHUB_ACTOR} --password-stdin
|
fi
|
||||||
# podman push "ghcr.io/$IMAGE_NAME:$VERSION"
|
podman build . --file Dockerfile --tag "$REGISTRY/$IMAGE_NAME:$VERSION"
|
||||||
# if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
podman push "$REGISTRY/$IMAGE_NAME:$VERSION"
|
||||||
# podman tag "ghcr.io/$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"
|
if [[ "$GITHUB_REF" =~ ^refs/tags.* ]]; then
|
||||||
# podman push "ghcr.io/$IMAGE_NAME:latest"
|
podman tag "$REGISTRY/$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"
|
||||||
# fi
|
podman push "$REGISTRY/$IMAGE_NAME:latest"
|
||||||
|
fi
|
||||||
# env:
|
# env:
|
||||||
# REG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
# REG_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
# # REG_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
|
# # REG_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
|
||||||
# IMAGE_NAME: jamesjonesconsulting/podman-dind-like
|
|
||||||
|
|||||||
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
|
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`.
|
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.
|
other self-hosted agents for other CI/CD self-hosted agents.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user