mirror of
https://git.turbo-data.com/nprasad2077/docker-templates.git
synced 2026-09-22 08:05:56 +00:00
47 lines
1.4 KiB
YAML
47 lines
1.4 KiB
YAML
# Sample: build (and optionally push) a Docker image with Gitea Actions.
|
|
# Copy into your repo as `.gitea/workflows/docker-build.yaml` and push.
|
|
# Requires a runner with `ubuntu-latest` that can reach a Docker daemon
|
|
# (the compose file bind-mounts /var/run/docker.sock for this).
|
|
#
|
|
# To push, create Gitea repo secrets REGISTRY, REGISTRY_USERNAME,
|
|
# REGISTRY_PASSWORD, IMAGE_NAME and uncomment the login/push steps.
|
|
name: docker-build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Build image (no push)
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
push: false
|
|
tags: sample-app:ci
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
|
|
# - name: Log in to registry
|
|
# uses: docker/login-action@v3
|
|
# with:
|
|
# registry: ${{ secrets.REGISTRY }}
|
|
# username: ${{ secrets.REGISTRY_USERNAME }}
|
|
# password: ${{ secrets.REGISTRY_PASSWORD }}
|
|
#
|
|
# - name: Build and push
|
|
# uses: docker/build-push-action@v6
|
|
# with:
|
|
# context: .
|
|
# push: true
|
|
# tags: ${{ secrets.REGISTRY }}/${{ secrets.IMAGE_NAME }}:${{ gitea.sha }}
|