Skip to content

build(ci): test config #2

build(ci): test config

build(ci): test config #2

Workflow file for this run

name: Build the container
on:
push:
jobs:
build_container:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup access to GitHub registry
run: |
echo "CI_REGISTRY_IMAGE=ghcr.io/${GITHUB_REPOSITORY}" >> $GITHUB_ENV
cat <<JSON > config.json
{
"auths": {
"ghcr.io": {
"username": "$GITHUB_ACTOR",
"password": "${{ secrets.GITHUB_TOKEN }}"
}
}
}
JSON
- name: Build the container
run: |
docker run \
-v $GITHUB_WORKSPACE:/workspace \
-v $GITHUB_WORKSPACE/config.json:/kaniko/.docker/config.json:ro \
gcr.io/kaniko-project/executor:latest \
--context dir:///workspace/ \
--dockerfile Dockerfile \
--cache \
--push-retry 3 \
--destination="${{ env.CI_REGISTRY_IMAGE }}:$GITHUB_SHA" \
--destination="${{ env.CI_REGISTRY_IMAGE }}:latest"
tag_container:
if: github.ref_name == 'main'
runs-on: ubuntu-latest
needs: build_container
steps:
# Install crane
- uses: imjasonh/[email protected]
- name: Tag the image as stable and with a datetime
run: |
crane tag "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA}" "stable"
crane tag "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA}" "$(date +%Y%m%d-%H%M%S)"