forked from kamba4/sunders
Removes offline and unavailable links #33
1 changed files with 29 additions and 43 deletions
commit
b2544cf267
|
|
@ -7,61 +7,47 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
container:
|
||||||
|
image: ghcr.io/osscontainertools/kaniko:alpine
|
||||||
steps:
|
steps:
|
||||||
|
- name: Install required system packages
|
||||||
|
run: apk add --no-cache nodejs git
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Check Docker CLI and daemon
|
|
||||||
run: |
|
|
||||||
if ! command -v docker >/dev/null 2>&1; then
|
|
||||||
echo "::error::docker CLI not found in PATH on this runner"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! docker info >/dev/null 2>&1; then
|
|
||||||
echo "::error::docker daemon is not reachable (check /var/run/docker.sock or DOCKER_HOST)"
|
|
||||||
docker version || true
|
|
||||||
env | grep '^DOCKER' || true
|
|
||||||
ls -l /var/run/docker.sock || true
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Login to Container Registry
|
|
||||||
if: github.event_name == 'push'
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.hamburg.ccc.de -u "${{ secrets.REGISTRY_USERNAME }}" --password-stdin
|
|
||||||
|
|
||||||
- name: Set image tags
|
- name: Set image tags
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ github.ref_name }}" = "main" ] && [ "${{ github.event_name }}" = "push" ]; then
|
if [ "${{ forgejo.ref_name }}" = "main" ] && [ "${{ forgejo.event_name }}" = "push" ]; then
|
||||||
echo "tag=latest" >> $GITHUB_OUTPUT
|
echo "tag=latest" >> $GITHUB_OUTPUT
|
||||||
else
|
else
|
||||||
# renovate creates sub branches with `/`; these break the tagging in the build process
|
# renovate creates sub branches with `/`; these break the tagging in the build process
|
||||||
echo tag=$(echo "${{ github.ref_name }}" | sed 's/[^a-zA-Z0-9._-]/_/g') >> $GITHUB_OUTPUT
|
echo tag=$(echo "${{ forgejo.ref_name }}" | sed 's/[^a-zA-Z0-9._-]/_/g') >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build web image
|
- name: Build web image
|
||||||
|
env:
|
||||||
|
KANIKO_NO_PUSH: ${{ forgejo.event_name != 'push' }}
|
||||||
|
KANIKO_GIT_HAMBURG_CCC_DE_USER: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
KANIKO_GIT_HAMBURG_CCC_DE_PASSWORD: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
docker build -f ./Containerfile -t git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }} .
|
/kaniko/executor \
|
||||||
working-directory: ./web
|
--dockerfile="${{ forgejo.workspace }}/web/Containerfile" \
|
||||||
|
--context="dir://${{ forgejo.workspace }}/web" \
|
||||||
|
--destination=git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }} \
|
||||||
|
--no-push-cache \
|
||||||
|
--credential-helpers=env
|
||||||
|
|
||||||
- name: Build data_handler image
|
- name: Build data_handler image
|
||||||
|
env:
|
||||||
|
KANIKO_NO_PUSH: ${{ forgejo.event_name != 'push' }}
|
||||||
|
KANIKO_GIT_HAMBURG_CCC_DE_USER: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
|
KANIKO_GIT_HAMBURG_CCC_DE_PASSWORD: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
docker build -f ./Containerfile -t git.hamburg.ccc.de/ccchh/sunders/data_handler:${{ steps.vars.outputs.tag }} .
|
/kaniko/executor \
|
||||||
working-directory: ./data_handler
|
--dockerfile="${{ forgejo.workspace }}/data_handler/Containerfile" \
|
||||||
|
--context="dir://${{ forgejo.workspace }}/data_handler" \
|
||||||
- name: Push images to Container Registry
|
--destination=git.hamburg.ccc.de/ccchh/sunders/data_handler:${{ steps.vars.outputs.tag }} \
|
||||||
run: |
|
--no-push-cache \
|
||||||
docker push git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }}
|
--credential-helpers=env
|
||||||
docker push git.hamburg.ccc.de/ccchh/sunders/data_handler:${{ steps.vars.outputs.tag }}
|
|
||||||
if: github.event_name == 'push'
|
|
||||||
|
|
||||||
- name: Update docker-compose.yml image tags
|
|
||||||
run: |
|
|
||||||
sed -i "s/:latest/:${{ steps.vars.outputs.tag }}/g" docker-compose.yml
|
|
||||||
|
|
||||||
- name: Start Docker Compose services
|
|
||||||
run: |
|
|
||||||
docker compose up -d --wait
|
|
||||||
docker compose down
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue