128 lines
3.9 KiB
YAML
128 lines
3.9 KiB
YAML
name: Build And Publish Doktainer Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- master
|
|
tags:
|
|
- "v*"
|
|
paths:
|
|
- "Dockerfile"
|
|
- "docker-compose.yml"
|
|
- "docker-compose.build.yml"
|
|
- "docker-entrypoint.sh"
|
|
- ".dockerignore"
|
|
- ".env.docker"
|
|
- "package.json"
|
|
- "package-lock.json"
|
|
- "next.config.ts"
|
|
- "tsconfig.json"
|
|
- "tsconfig.server.json"
|
|
- "eslint.config.mjs"
|
|
- "postcss.config.mjs"
|
|
- "prisma/**"
|
|
- "public/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "tests/**"
|
|
- ".github/workflows/doktainer-image.yml"
|
|
pull_request:
|
|
paths:
|
|
- "Dockerfile"
|
|
- "docker-compose.yml"
|
|
- "docker-compose.build.yml"
|
|
- "docker-entrypoint.sh"
|
|
- ".dockerignore"
|
|
- ".env.docker"
|
|
- "package.json"
|
|
- "package-lock.json"
|
|
- "next.config.ts"
|
|
- "tsconfig.json"
|
|
- "tsconfig.server.json"
|
|
- "eslint.config.mjs"
|
|
- "postcss.config.mjs"
|
|
- "prisma/**"
|
|
- "public/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "tests/**"
|
|
- ".github/workflows/doktainer-image.yml"
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
DOCKERHUB_IMAGE: doktainer/doktainer
|
|
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/doktainer
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to GHCR
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Log in to Docker Hub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Extract image metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ env.IMAGE_NAME }},${{ env.DOCKERHUB_IMAGE }}
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest,enable={{is_default_branch}}
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=sha,prefix=sha-
|
|
labels: |
|
|
org.opencontainers.image.title=Doktainer
|
|
org.opencontainers.image.description=Doktainer is a self-hosted PaaS that makes it easy to deploy and manage containerized applications. With Doktainer, you can deploy your applications with just a few clicks, and let it handle the rest.
|
|
org.opencontainers.image.url=https://doktainer.com
|
|
org.opencontainers.image.vendor=KodekaTeam
|
|
|
|
- name: Build and optionally push image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
build-args: |
|
|
NEXT_PUBLIC_API_URL=${{ vars.NEXT_PUBLIC_API_URL }}
|
|
NEXT_PUBLIC_WS_URL=${{ vars.NEXT_PUBLIC_WS_URL }}
|
|
NEXT_PUBLIC_API_PORT=${{ vars.NEXT_PUBLIC_API_PORT || '4000' }}
|
|
NEXT_PUBLIC_PANEL_NAME=${{ vars.NEXT_PUBLIC_PANEL_NAME || 'DOKTAINER' }}
|
|
# NEXT_PUBLIC_VERSION=${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
|
|
NEXT_PUBLIC_VERSION=${{ vars.NEXT_PUBLIC_VERSION || 'v0.1.0' }}
|
|
NEXT_PUBLIC_BATCH=${{ vars.NEXT_PUBLIC_BATCH || 'Batch-20260606' }}
|
|
|
|
- name: Post-push summary
|
|
if: github.event_name != 'pull_request'
|
|
run: |
|
|
echo "Published tags:"
|
|
echo "${{ steps.meta.outputs.tags }}"
|