OpenLDAP-FusionDirectory-Do.../.forgejo/workflows/docker.yaml
flifloo 0051463eea
All checks were successful
Build Docker image and publish / docker (push) Successful in 41s
Migrate CI
2024-02-17 00:04:53 +01:00

63 lines
1.7 KiB
YAML

name: Build Docker image and publish
on: [push]
env:
DOCKER_REPOSITORY: "git.flifloo.fr"
jobs:
docker:
runs-on: docker
container:
image: docker:cli
env:
DOCKER_HOST: tcp://dind:2375
services:
dind:
image: docker:dind
cmd: [ "dockerd", "-H", "tcp://0.0.0.0:2375", "--tls=false" ]
steps:
- name: "Setup env"
id: env
run: |
echo "DOCKER_TAG=$DOCKER_REPOSITORY/$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]'):latest" >> "$GITHUB_ENV"
apk add --no-cache git nodejs tar zstd
- name: "Get repo"
uses: actions/checkout@v4
- name: "Restore cache"
id: cache-restore
uses: actions/cache/restore@v4
with:
path: "${{ env.GITHUB_WORKSPACE }}/.docker_cache"
key: "docker"
- name: Set up Docker Buildx
uses: https://github.com/docker/setup-buildx-action@v3
- name: "Login to Docker repository"
uses: https://github.com/docker/login-action@v3
with:
registry: "${{ env.DOCKER_REPOSITORY }}"
username: "${{ env.GITHUB_ACTOR }}"
password: "${{ secrets.PACKAGE_TOKEN }}"
- name: "Build and push"
uses: https://github.com/docker/build-push-action@v5
with:
context: .
push: true
tags: "${{ env.DOCKER_TAG }}"
cache-from: "type=local,src=${{ env.GITHUB_WORKSPACE }}/.docker_cache"
cache-to: "type=local,dest=${{ env.GITHUB_WORKSPACE }}/.docker_cache"
- name: "Save cache"
id: cache-save
uses: actions/cache/save@v4
with:
path: "${{ env.GITHUB_WORKSPACE }}/.docker_cache"
key: "${{ steps.cache-restore.outputs.cache-primary-key }}"