39 lines
922 B
YAML
39 lines
922 B
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 vars"
|
||
|
id: env
|
||
|
run: |
|
||
|
echo "DOCKER_TAG=$DOCKER_REPOSITORY/$(echo "$GITHUB_REPOSITORY" | tr '[:upper:]' '[:lower:]'):latest" >> "$GITHUB_ENV"
|
||
|
|
||
|
- name: "Login to Docker repository"
|
||
|
id: login
|
||
|
run: docker login -u "$GITHUB_REPOSITORY_OWNER" -p "$GITHUB_TOKEN" "$DOCKER_REPOSITORY"
|
||
|
|
||
|
- name: "Build Docker image"
|
||
|
id: build
|
||
|
run: docker buildx build --platform linux/amd64 -t "$DOCKER_TAG" .
|
||
|
|
||
|
- name: "Publish Docker image"
|
||
|
id: push
|
||
|
run: docker push "$DOCKER_TAG"
|