commit 283a30ec3d5c070639f97e43463bc4bf960b0e1a Author: Your Name Date: Sat Aug 23 09:05:08 2025 +0000 first commit diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..9bcc41b --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,26 @@ +name: Release + +on: [push] + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: actions/docker-login@v2 + with: + registry: git.coocn.cn + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + - name: Build and push Docker image + uses: actions/docker-build@v5 + with: + context: . + push: true + tags: git.coocn.cn/${{ github.repository }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..94aed71 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM ubuntu:22.04 + +# 安装依赖并下载 nerdctl +RUN apt-get update && apt-get install -y curl tar ca-certificates \ + && VERSION=1.7.7 \ + && curl -L https://github.com/containerd/nerdctl/releases/download/v${VERSION}/nerdctl-${VERSION}-linux-amd64.tar.gz -o /tmp/nerdctl.tgz \ + && tar -xzf /tmp/nerdctl.tgz -C /usr/local/bin \ + && rm -rf /var/lib/apt/lists/* /tmp/* + +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] diff --git a/action.yml b/action.yml new file mode 100644 index 0000000..322ac23 --- /dev/null +++ b/action.yml @@ -0,0 +1,16 @@ +name: "Nerdctl Compose Action" +description: "在容器中使用 nerdctl 启动容器" +author: "coocn" + +inputs: + file: + description: "要启动的Compose配置文件路径" + required: true + args: + description: "传递给 nerdctl 的参数" + required: false + default: up -d + +runs: + using: "docker" + image: "docker://ghcr.io/${{ github.repository }}:latest" diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100755 index 0000000..e60736d --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +echo "Running nerdctl compose with file: $INPUT_FILE" +exec nerdctl compose -f "$INPUT_FILE" $INPUT_ARGS