2023-09-09 13:54:00 +00:00
|
|
|
name: "PamGram Docker Build"
|
2023-02-10 14:41:12 +00:00
|
|
|
|
|
|
|
# Controls when the action will run.
|
|
|
|
on:
|
|
|
|
# Triggers the workflow on push or pull request events but only for the master branch
|
2023-02-11 10:26:49 +00:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
tags:
|
2023-03-14 12:33:36 +00:00
|
|
|
description: 'main version tag, example: v4'
|
2023-02-11 10:26:49 +00:00
|
|
|
required: true
|
2023-03-14 12:33:36 +00:00
|
|
|
default: 'v4'
|
2023-02-10 14:41:12 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: docker build and publish
|
|
|
|
env:
|
|
|
|
DOCKER_BUILDKIT: 1
|
|
|
|
DOCKER_CLI_EXPERIMENTAL: enabled
|
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
2023-09-09 13:54:00 +00:00
|
|
|
DOCKERHUB_REPOSITORY: ${{ vars.DOCKER_PAMGRAM_REPO }}
|
2023-02-11 10:26:49 +00:00
|
|
|
DOCKER_TAG: ${{ github.event.inputs.tags }}
|
2023-02-10 14:41:12 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
|
|
|
|
- name: Setup Docker Buildx
|
|
|
|
uses: crazy-max/ghaction-docker-buildx@v3
|
|
|
|
|
|
|
|
- name: Buildx cache
|
|
|
|
uses: actions/cache@v2
|
|
|
|
id: buildx-cache
|
|
|
|
with:
|
|
|
|
path: /tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-buildx
|
|
|
|
|
2023-02-11 10:26:49 +00:00
|
|
|
- name: Download Dockerfile
|
|
|
|
run: |
|
2023-09-09 13:54:00 +00:00
|
|
|
wget -O Dockerfile https://raw.githubusercontent.com/PaiGramTeam/PamGram/sr/Dockerfile
|
2023-02-11 10:26:49 +00:00
|
|
|
|
2023-02-10 14:41:12 +00:00
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
docker buildx build \
|
|
|
|
--cache-from "type=local,src=/tmp/.buildx-cache" \
|
|
|
|
--cache-to "type=local,dest=/tmp/.buildx-cache" \
|
|
|
|
--output "type=image,push=true" \
|
|
|
|
--platform "linux/amd64,linux/arm64/v8" \
|
2023-02-11 10:26:49 +00:00
|
|
|
--tag "${DOCKERHUB_REPOSITORY}:${DOCKER_TAG}" \
|
2023-02-10 14:41:12 +00:00
|
|
|
-f Dockerfile \
|
|
|
|
.
|