Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.git
.github
.omx
.vscode
.idea
node_modules
dist
build
logs
docs
.env
.env.*
*.log
*.tmp
*.temp
cursor2api-go
cursor2api-go.exe

86 changes: 86 additions & 0 deletions .github/workflows/docker-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish Docker Image

on:
workflow_dispatch:
inputs:
push:
description: Push image to GHCR
type: boolean
required: true
default: true
platforms:
description: Target platforms
type: string
required: true
default: linux/amd64,linux/arm64
push:
branches:
- main
tags:
- "v*"

permissions:
contents: read
packages: write

env:
REGISTRY: ghcr.io

jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Prepare image metadata
id: prep
shell: bash
run: |
image="${REGISTRY}/${GITHUB_REPOSITORY}"
image="$(echo "${image}" | tr '[:upper:]' '[:lower:]')"
echo "image=${image}" >> "${GITHUB_OUTPUT}"

should_push=true
if [[ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" && "${{ inputs.push }}" != "true" ]]; then
should_push=false
fi
echo "push=${should_push}" >> "${GITHUB_OUTPUT}"

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to GHCR
if: steps.prep.outputs.push == 'true'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate Docker tags
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.prep.outputs.image }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha
type=raw,value=latest,enable={{is_default_branch}}

- name: Build and publish image
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
platforms: ${{ github.event_name == 'workflow_dispatch' && inputs.platforms || 'linux/amd64,linux/arm64' }}
push: ${{ steps.prep.outputs.push == 'true' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,3 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Docker
.dockerignore