diff --git a/.github/workflows/doktainer-image.yml b/.github/workflows/doktainer-image.yml new file mode 100644 index 0000000..b3811d3 --- /dev/null +++ b/.github/workflows/doktainer-image.yml @@ -0,0 +1,116 @@ +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: + IMAGE_NAME: ghcr.io/doktainer/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: Extract image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.IMAGE_NAME }} + tags: | + 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_BATCH=${{ vars.NEXT_PUBLIC_BATCH || 'Batch-20260515' }} + + - name: Post-push summary + if: github.event_name != 'pull_request' + run: | + echo "Published tags:" + echo "${{ steps.meta.outputs.tags }}"