mirror of https://github.com/1N3/Sn1per.git
55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- gh-action
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
- name: Setting parameters
|
|
run: |-
|
|
echo abc
|
|
ls -al
|
|
|
|
- name: Build and push Docker image
|
|
id: docker_build
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
file: Dockerfile.base
|
|
push: true
|
|
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
|
|
|
|
- name: Docker image metadata
|
|
id: image_meta
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ghcr.io/${{ github.repository }}
|
|
flavor: latest=true
|
|
tags: |
|
|
type=sha
|
|
|
|
- name: Login to ghcr.io
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Push metadata to image
|
|
run: docker push ghcr.io/${{ github.repository }}
|
|
|
|
- name: Push tags to image
|
|
run: docker push ${{ steps.image_meta.outputs.tags }}
|