2024-02-16 21:41:55 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
- name: "Login to Docker repository"
|
2024-02-16 23:05:53 +01:00
|
|
|
uses: https://github.com/docker/login-action@v3
|
|
|
|
with:
|
|
|
|
registry: "$DOCKER_REPOSITORY"
|
|
|
|
username: "$GITHUB_ACTOR"
|
|
|
|
password: "${{ secrets.PACKAGE_TOKEN }}"
|
|
|
|
|
|
|
|
- name: "Build and push"
|
|
|
|
use: https://github.com/docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: "$DOCKER_TAG"
|
|
|
|
cache-from: type=gha
|
|
|
|
cache-to: type=gha,mode=max
|