fix??:
This commit is contained in:
parent
89edfcb3aa
commit
d6c0bcaedc
@ -1,38 +1,43 @@
|
|||||||
name: Build and push docker image
|
name: build and push docker image
|
||||||
run-name: Building docker image and push them to git.dacremont.xyz
|
run-name: building docker image and push them to git.dacremont.xyz
|
||||||
on:
|
on:
|
||||||
workflow_dispatch: {}
|
workflow_dispatch: {}
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: [ "main" ]
|
||||||
paths:
|
paths:
|
||||||
- 'Dockerfile'
|
- 'dockerfile'
|
||||||
# Publish semver tags as releases.
|
# publish semver tags as releases.
|
||||||
tags: [ 'v*.*.*' ]
|
tags: [ 'v*.*.*' ]
|
||||||
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
# Use docker.io for Docker Hub if empty
|
# use docker.io for docker hub if empty
|
||||||
REGISTRY: git.dacremont.xyz
|
registry: git.dacremont.xyz
|
||||||
# gitea.repository as <account>/<repo>
|
# gitea.repository as <account>/<repo>
|
||||||
IMAGE_NAME: ${{ gitea.repository }}
|
image_name: ${{ gitea.repository }}
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Build-and-push-docker:
|
build-and-push-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container: ghcr.io/catthehacker/ubuntu:act-latest
|
container: ghcr.io/catthehacker/ubuntu:act-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
# This is used to complete the identity challenge
|
# this is used to complete the identity challenge
|
||||||
# with sigstore/fulcio when running outside of PRs.
|
# with sigstore/fulcio when running outside of prs.
|
||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Restore Docker cache
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
driver: docker-container
|
||||||
|
|
||||||
|
- name: restore docker cache
|
||||||
uses: actions/cache@v3
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: /tmp/.buildx-cache
|
path: /tmp/.buildx-cache
|
||||||
@ -40,16 +45,16 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
# Login against a Docker registry except on PR
|
# login against a docker registry except on pr
|
||||||
# https://`.com/docker/login-action
|
# https://`.com/docker/login-action
|
||||||
- name: Log into registry ${{ env.REGISTRY }}
|
- name: log into registry ${{ env.registry }}
|
||||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.registry }}
|
||||||
username: ${{ secrets.username }}
|
username: ${{ secrets.username }}
|
||||||
password: ${{ secrets.TOKEN }}
|
password: ${{ secrets.token }}
|
||||||
|
|
||||||
- name: Build and push docker image
|
- name: build and push docker image
|
||||||
uses: docker/build-push-action@v4
|
uses: docker/build-push-action@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@ -57,8 +62,13 @@ jobs:
|
|||||||
pull: true
|
pull: true
|
||||||
no-cache: true
|
no-cache: true
|
||||||
tags: |
|
tags: |
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.sha }}
|
${{ env.registry }}/${{ env.image_name }}:${{ gitea.sha }}
|
||||||
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
${{ env.registry }}/${{ env.image_name }}:latest
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
|
||||||
|
- name: move exported cache back (workaround)
|
||||||
|
run: |
|
||||||
|
rm -rf /tmp/.buildx-cache
|
||||||
|
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user