init
This commit is contained in:
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@@ -0,0 +1 @@
|
||||
.github
|
||||
72
.github/workflows/docker.yaml
vendored
Normal file
72
.github/workflows/docker.yaml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
name: Docker Build
|
||||
run-name: ${{ github.actor }} run Actions
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
REGISTERY_USER:
|
||||
required: true
|
||||
description: 'Username for Docker registry'
|
||||
REGISTERY_PASSWORD:
|
||||
required: true
|
||||
description: 'Password for Docker registry'
|
||||
inputs:
|
||||
Dockerfile:
|
||||
required: false
|
||||
type: string
|
||||
default: ./Dockerfile
|
||||
registry:
|
||||
required: false
|
||||
type: string
|
||||
default: ${{ vars.REGISTERY_ADDRESS }}
|
||||
tags:
|
||||
required: false
|
||||
type: string
|
||||
default: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha
|
||||
type=sha,format=long
|
||||
outputs:
|
||||
image_name:
|
||||
description: 'The built image name'
|
||||
value: ${{ inputs.image }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: rlespinasse/github-slug-action@v5
|
||||
id: slug
|
||||
- name: debug info
|
||||
run: |
|
||||
printenv
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-qemu-action@v2
|
||||
- uses: docker/login-action@v2
|
||||
with:
|
||||
registry: ${{ inputs.registry }}
|
||||
username: ${{ secrets.REGISTERY_USER }}
|
||||
password: ${{ secrets.REGISTERY_PASSWORD }}
|
||||
- name: echo image name
|
||||
run: echo "Image name is ${{ inputs.registry }}/${GITHUB_REPOSITORY_OWNER_PART_SLUG_CS}/${GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS}"
|
||||
- name: Docker metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ inputs.registry }}/${GITHUB_REPOSITORY_OWNER_PART_SLUG_CS}/${GITHUB_REPOSITORY_NAME_PART_SLUG_URL_CS}
|
||||
tags: ${{ inputs.tags }}
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ${{ inputs.Dockerfile }}
|
||||
push: true
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
annotations: ${{ steps.meta.outputs.annotations }}
|
||||
15
.github/workflows/test-buil-docker.yaml
vendored
Normal file
15
.github/workflows/test-buil-docker.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
name: Docker Image CI
|
||||
run-name: ${{ github.actor }} run Actions 🚀
|
||||
|
||||
on:
|
||||
- push
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
uses: ./.github/workflows/docker.yaml
|
||||
with:
|
||||
registry: ${{ vars.REGISTERY_ADDRESS }}
|
||||
image: ${{ vars.REGISTERY_ADDRESS }}/${{ github.repository }}
|
||||
secrets:
|
||||
REGISTERY_USER: ${{ secrets.REGISTERY_USER }}
|
||||
REGISTERY_PASSWORD: ${{ secrets.REGISTERY_PASSWORD }}
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.act
|
||||
2
Dockerfile
Normal file
2
Dockerfile
Normal file
@@ -0,0 +1,2 @@
|
||||
FROM nginx:latest
|
||||
COPY . /usr/share/nginx/html/
|
||||
Reference in New Issue
Block a user