56 lines
2.2 KiB
YAML
56 lines
2.2 KiB
YAML
name: ci
|
|
|
|
#https://docs.docker.com/build/ci/github-actions/push-multi-registries/
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
# Test with privileges true in runner config
|
|
|
|
# INSTALL docker
|
|
- run: apt-get update
|
|
- run: apt-get -y install curl dnsutils
|
|
- run: install -m 0755 -d /etc/apt/keyrings
|
|
- run: curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
- run: chmod a+r /etc/apt/keyrings/docker.gpg
|
|
- run: echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
- run: apt-get update
|
|
- run: apt-get -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
|
|
|
# BUILD & PUSH
|
|
- name: Checkout private tools
|
|
uses: actions/checkout@v4
|
|
with:
|
|
# tape git@gitea.jingoh.fr port 22 et pas port 443 cet ane (should be ssh://gitea.jingoh.fr:443/$repository au lieu de ssh://gitea.jingoh.fr:$repository)
|
|
repository: staffadmin/gitea-runner
|
|
persist-credentials: false
|
|
ssh-strict: false
|
|
token: ${{ secrets.ACCESS_TOKEN_GIT }}
|
|
ssh-known-hosts: ${{ secrets.SSH_KNOWN_GITEA }}
|
|
# - name: Set up Docker Buildx
|
|
# uses: docker/setup-buildx-action@v3
|
|
- name: Login to Docker private registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ vars.REGISTRY_DOCKER }}
|
|
username: ${{ secrets.REGISTRY_DOCKER_USER }}
|
|
password: ${{ secrets.REGISTRY_DOCKER_PASS }}
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
registry: ${{ vars.REGISTRY_DOCKER }}
|
|
username: ${{ secrets.REGISTRY_DOCKER_USER }}
|
|
password: ${{ secrets.REGISTRY_DOCKER_PASS }}
|
|
# platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ vars.REGISTRY_DOCKER }}/user/app:latest
|
|
secrets: |
|
|
GIT_AUTH_TOKEN=${{ secrets.ACCESS_TOKEN_GIT }} |