Add Dockerfile
All checks were successful
check-and-test / check-and-test (pull_request) Successful in 17s
check-and-test / Run govulncheck (pull_request) Successful in 28s

This commit is contained in:
2025-04-06 12:05:53 +08:00
parent 0535f5bab7
commit 05be0f596b

View File

@@ -0,0 +1,52 @@
name: release-nightly
on:
push:
branches: [main]
tags:
- "*"
jobs:
release-image:
runs-on: ubuntu-latest
env:
DOCKER_ORG: gitea
DOCKER_LATEST: nightly
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # all history for all branches and tags
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker BuildX
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Get Meta
id: meta
run: |
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
echo REPO_VERSION=${GITHUB_REF_NAME#v} >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
target: basic
platforms: |
linux/amd64
linux/arm64
push: true
tags: |
${{ env.DOCKER_ORG }}/${{ steps.meta.outputs.REPO_NAME }}:${{ env.DOCKER_LATEST }}
build-args: |
VERSION=${{ steps.meta.outputs.DOCKER_LATEST }}

18
Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM golang:1.24-alpine AS builder
ARG VERSION
WORKDIR /build
COPY . .
RUN go mod download
RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION}" -o gitea-mcp
FROM scratch
WORKDIR /app
COPY --from=builder /build/gitea-mcp .
CMD ["./gitea-mcp", "-t", "stdio"]

File diff suppressed because one or more lines are too long

View File

@@ -37,7 +37,7 @@ func Default() *zap.Logger {
}
core := zapcore.NewCore(enc, ws, level)
options := []zap.Option{
zap.AddStacktrace(zapcore.ErrorLevel),
zap.AddStacktrace(zapcore.DPanicLevel),
zap.AddCaller(),
zap.AddCallerSkip(1),
}