Skip to content

Commit d720f10

Browse files
EPMRPP-110531 || MCP Server. Deploy. Move docker image build to the release github action
1 parent e31465a commit d720f10

File tree

3 files changed

+61
-53
lines changed

3 files changed

+61
-53
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,35 @@ jobs:
7070
version: latest
7171
args: release --clean
7272
env:
73-
REPOSITORY_NAME: reportportal/mcp-server # Docker repository name
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication
73+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token for authentication
74+
75+
# Step 7: Generate build timestamp
76+
- name: Generate build timestamp
77+
id: build_date
78+
run: echo "timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> $GITHUB_OUTPUT
79+
80+
# Step 8: Build and push multi-arch Docker image using Buildx
81+
- name: Build and push Docker image
82+
uses: docker/build-push-action@v6
83+
with:
84+
context: .
85+
file: ./release.dockerfile
86+
platforms: linux/amd64,linux/arm64
87+
push: true
88+
tags: |
89+
reportportal/mcp-server:${{ github.event.inputs.version }}
90+
reportportal/mcp-server:latest
91+
build-args: |
92+
VERSION=${{ github.event.inputs.version }}
93+
COMMIT=${{ github.sha }}
94+
BUILD_DATE=${{ steps.build_date.outputs.timestamp }}
95+
labels: |
96+
io.artifacthub.package.readme-url=https://raw.githubusercontent.com/reportportal/reportportal-mcp-server/main/README.md
97+
io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/17636279
98+
io.artifacthub.package.maintainers=[{"name":"Andrei Varabyeu","email":"[email protected]"},{"name":"Aleksandr Paramonov","email":"[email protected]"}]
99+
org.opencontainers.image.description=ReportPortal MCP Server
100+
org.opencontainers.image.name=reportportal-mcp-server
101+
org.opencontainers.image.revision=${{ github.sha }}
102+
org.opencontainers.image.version=${{ github.event.inputs.version }}
103+
org.opencontainers.image.source=https://github.com/reportportal/reportportal-mcp-server
104+
org.opencontainers.image.created=${{ steps.build_date.outputs.timestamp }}

.goreleaser.yaml

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -26,51 +26,8 @@ archives:
2626
- LICENSE
2727
- README.md
2828

29-
dockers:
30-
- image_templates:
31-
- "{{ .Env.REPOSITORY_NAME }}:{{ .Version }}-amd64"
32-
dockerfile: release.dockerfile
33-
use: buildx
34-
build_flag_templates:
35-
- "--platform=linux/amd64"
36-
- "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/reportportal/reportportal-mcp-server/main/README.md"
37-
- "--label=io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/17636279"
38-
- '--label=io.artifacthub.package.maintainers=[{"name":"Andrei Varabyeu","email":"[email protected]"},{"name":"Aleksandr Paramonov","email":"[email protected]"}]'
39-
- "--label=org.opencontainers.image.description=ReportPortal MCP Server"
40-
- "--label=org.opencontainers.image.created={{.Date}}"
41-
- "--label=org.opencontainers.image.name={{.ProjectName}}"
42-
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
43-
- "--label=org.opencontainers.image.version={{.Version}}"
44-
- "--label=org.opencontainers.image.source={{.GitURL}}"
45-
goos: linux
46-
goarch: amd64
47-
- image_templates:
48-
- "{{ .Env.REPOSITORY_NAME }}:{{ .Version }}-arm64"
49-
dockerfile: release.dockerfile
50-
use: buildx
51-
build_flag_templates:
52-
- "--platform=linux/arm64"
53-
- "--label=io.artifacthub.package.readme-url=https://raw.githubusercontent.com/reportportal/reportportal-mcp-server/main/README.md"
54-
- "--label=io.artifacthub.package.logo-url=https://avatars.githubusercontent.com/u/17636279"
55-
- '--label=io.artifacthub.package.maintainers=[{"name":"Andrei Varabyeu","email":"[email protected]"},{"name":"Aleksandr Paramonov","email":"[email protected]"}]'
56-
- "--label=org.opencontainers.image.description=ReportPortal MCP Server"
57-
- "--label=org.opencontainers.image.created={{.Date}}"
58-
- "--label=org.opencontainers.image.name={{.ProjectName}}"
59-
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
60-
- "--label=org.opencontainers.image.version={{.Version}}"
61-
- "--label=org.opencontainers.image.source={{.GitURL}}"
62-
goos: linux
63-
goarch: arm64
64-
65-
docker_manifests:
66-
- name_template: "{{ .Env.REPOSITORY_NAME }}:{{ .Version }}"
67-
image_templates:
68-
- "{{ .Env.REPOSITORY_NAME }}:{{ .Version }}-amd64"
69-
- "{{ .Env.REPOSITORY_NAME }}:{{ .Version }}-arm64"
70-
- name_template: "{{ .Env.REPOSITORY_NAME }}:latest"
71-
image_templates:
72-
- "{{ .Env.REPOSITORY_NAME }}:{{ .Version }}-amd64"
73-
- "{{ .Env.REPOSITORY_NAME }}:{{ .Version }}-arm64"
29+
# Docker images are built separately using Docker Buildx in the workflow
30+
# This creates clean multi-arch images without intermediate architecture-specific tags
7431

7532

7633
## Uncomment the following sections if you want to create Homebrew Casks or NFPMS (Deb/RPM packages).

release.dockerfile

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
1-
# Make a stage to run the app
1+
# Build stage
2+
FROM golang:1.24.4 AS builder
3+
4+
WORKDIR /build
5+
6+
# Copy go mod files first for better caching
7+
COPY go.mod go.sum ./
8+
RUN go mod download
9+
10+
# Copy source code
11+
COPY . .
12+
13+
# Build arguments for version info
14+
ARG VERSION=dev
15+
ARG COMMIT=unknown
16+
ARG BUILD_DATE=unknown
17+
18+
# Build the binary
19+
RUN CGO_ENABLED=0 go build -ldflags="-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.date=${BUILD_DATE}" -o reportportal-mcp-server ./cmd/reportportal-mcp-server
20+
21+
# Final stage
222
FROM gcr.io/distroless/base-debian12
3-
# Set the working directory
23+
424
WORKDIR /server
5-
# Copy the binary
6-
# see https://goreleaser.com/errors/docker-build/#do
7-
COPY reportportal-mcp-server .
25+
26+
# Copy the binary from builder
27+
COPY --from=builder /build/reportportal-mcp-server .
28+
829
# Command to run the server
9-
CMD ["./reportportal-mcp-server"]
30+
CMD ["./reportportal-mcp-server"]

0 commit comments

Comments
 (0)