Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build-services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ jobs:
service: openev-data-mcp-service
push: ${{ github.event_name != 'pull_request' }}
repository: openev-data-mcp-service
dockerfile: "./build/service/Dockerfile"
dockerfile: "./build/Dockerfile"
secrets: inherit
52 changes: 52 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Release

on:
push:
tags:
- 'v*' # Trigger on version tags like v1.0.0
workflow_dispatch:

jobs:
release:
name: Run GoReleaser
runs-on: ubuntu-latest
permissions:
contents: write
packages: write

steps:
# Checkout the code
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

# Set up Go environment
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.24

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

# Login to GitHub Container Registry
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Run GoReleaser
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}

53 changes: 53 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# GoReleaser configuration file
version: 2

# General settings
project_name: openev-data-mcp
builds:
- id: bin
main: ./cmd/app
binary: openev-data-mcp
goos:
- freebsd
- windows
- darwin
- linux
goarch:
- amd64
- arm64
- arm
ignore:
- goos: windows
goarch: arm
- goos: freebsd
goarch: arm

archives:
- id: bin-archive
formats:
- tar.gz
files:
- LICENSE.md
- README.md

dockers_v2:
- images:
- "ghcr.io/chargepi/openev-data-mcp"
tags:
- "{{ .Tag }}"
- "latest"
dockerfile: Dockerfile.release
platforms:
- linux/amd64
- linux/arm64

release:
github:
owner: "{{ .Env.GITHUB_REPOSITORY_OWNER }}"
name: openev-data-mcp

changelog:
sort: asc
filters:
exclude:
- '.*\.md$'
12 changes: 12 additions & 0 deletions Dockerfile.release
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM alpine:3.21

ARG TARGETPLATFORM
ARG user=app
ARG group=docker
RUN addgroup $group && adduser -D -G $group $user
USER $user

WORKDIR /usr/local/bin
COPY --chown=$user:$group $TARGETPLATFORM/openev-data-mcp /usr/local/bin/openev-data-mcp

CMD ["/usr/local/bin/openev-data-mcp"]
12 changes: 6 additions & 6 deletions build/service/Dockerfile → build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN go mod verify

COPY . .

RUN --mount=type=cache,target="/root/.cache/go-build" go build -o ../service ./cmd/app
RUN --mount=type=cache,target="/root/.cache/go-build" go build -o ../openev-data-mcp ./cmd/app

# Debug stage using Delve
FROM build AS debug
Expand All @@ -22,9 +22,9 @@ COPY --from=build /app/src /service/src
WORKDIR /service/src

RUN go install github.com/go-delve/delve/cmd/dlv@latest
RUN go build -gcflags="all=-N -l" -o ./service ./cmd/app
RUN go build -gcflags="all=-N -l" -o ./openev-data-mcp ./cmd/app

CMD ["/go/bin/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "./service"]
CMD ["/go/bin/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "--accept-multiclient", "exec", "./openev-data-mcp"]

# Fetch grpc_health_probe for the final image health check
FROM alpine:3.21 AS health-probe
Expand All @@ -44,13 +44,13 @@ RUN addgroup $group && \
--ingroup $group \
$user

COPY --chown=$user:$group --from=build /app/service /usr/local/bin/service
COPY --chown=$user:$group --from=build /app/openev-data-mcp /usr/local/bin/openev-data-mcp
COPY --from=health-probe /grpc_health_probe /usr/local/bin/grpc_health_probe

USER $user
WORKDIR /usr/local/service
WORKDIR /usr/local/openev-data-mcp

HEALTHCHECK --interval=10s --timeout=3s --retries=3 \
CMD ["/usr/local/bin/grpc_health_probe", "-addr=:9090"]

CMD ["/usr/local/bin/service"]
CMD ["/usr/local/bin/openev-data-mcp"]
2 changes: 1 addition & 1 deletion deployments/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
app:
build:
context: ../..
dockerfile: build/service/Dockerfile
dockerfile: ../../build/Dockerfile
restart: unless-stopped
environment:
OPENEV_MCP_DATABASE_HOST: db
Expand Down
Loading