Skip to content

Commit 7030f93

Browse files
committed
fix: pin version
1 parent d92b95f commit 7030f93

File tree

2 files changed

+15
-39
lines changed

2 files changed

+15
-39
lines changed

.github/workflows/docker.yaml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,9 @@ permissions:
88
contents: read
99
issues: write
1010
jobs:
11-
properties:
12-
name: Set properties
13-
runs-on: ubuntu-latest
14-
outputs:
15-
date: ${{ steps.set-properties.outputs.DATE }}
16-
version: ${{ steps.set-properties.outputs.VERSION }}
17-
steps:
18-
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
19-
with:
20-
config: ${{ vars.PERMISSIONS_CONFIG }}
21-
- name: Check out code
22-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
23-
- name: Set properties
24-
id: set-properties
25-
run: |
26-
DATE=$(date +'%Y-%m-%d')
27-
VERSION=$(npm pkg get version | tr -d '"')
28-
echo "DATE=${DATE}" >> "$GITHUB_OUTPUT"
29-
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
3011
push:
31-
name: Build and publish docker image
12+
name: Set properties
3213
runs-on: ubuntu-latest
33-
needs: properties
3414
env:
3515
IMAGE_REPOSITORY: docker.io/mongodb/apix_test
3616
TAG_PREFIX: mongodb-mcp-server-
@@ -40,29 +20,36 @@ jobs:
4020
config: ${{ vars.PERMISSIONS_CONFIG }}
4121
- name: Check out code
4222
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
43-
with:
44-
ref: v${{ needs.properties.outputs.version }}
4523
- name: Set up Docker Buildx
4624
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
4725
- name: Login to Docker Hub
4826
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
4927
with:
5028
username: "${{ secrets.DOCKERHUB_USERNAME }}"
5129
password: "${{ secrets.DOCKERHUB_SECRET }}"
30+
- name: Set properties
31+
id: set-properties
32+
run: |
33+
DATE=$(date +'%Y-%m-%d')
34+
VERSION=$(npm pkg get version | tr -d '"')
35+
echo "DATE=${DATE}" >> "$GITHUB_OUTPUT"
36+
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
5237
- name: Build and push image to dockerhub registry
5338
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
5439
with:
5540
context: .
5641
platforms: linux/amd64,linux/arm64
5742
# TODO: add latest tag
58-
tags: ${{ env.IMAGE_REPOSITORY }}:${{ env.TAG_PREFIX }}${{ needs.properties.outputs.version }}, ${{ env.IMAGE_REPOSITORY }}:${{ env.TAG_PREFIX }}${{ needs.properties.outputs.version }}-${{ needs.properties.outputs.date }}
43+
tags: ${{ env.IMAGE_REPOSITORY }}:${{ env.TAG_PREFIX }}${{ steps.set-properties.outputs.VERSION }}, ${{ env.IMAGE_REPOSITORY }}:${{ env.TAG_PREFIX }}${{ steps.set-properties.outputs.VERSION }}-${{ steps.set-properties.outputs.DATE }}
5944
file: Dockerfile
6045
push: true
46+
build-args: |
47+
VERSION=${{ steps.set-properties.outputs.VERSION }}
6148
# - name: Create Issue
6249
# if: ${{ failure() }}
6350
# uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd
6451
# with:
6552
# labels: failed-release
66-
# title: Release Failure for Docker Image ${{ env.TAG_PREFIX }}${{ needs.properties.outputs.version }}-${{ needs.properties.outputs.date }}
53+
# title: Release Failure for Docker Image ${{ env.TAG_PREFIX }}${{ steps.set-properties.outputs.VERSION }}-${{ steps.set-properties.outputs.DATE }}
6754
# body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
6855
# TODO: enable before merging

Dockerfile

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,4 @@
1-
FROM node:22-alpine AS build
2-
WORKDIR /app
3-
COPY package.json package-lock.json tsconfig.build.json ./
4-
RUN npm install --ignore-scripts
5-
COPY src src
6-
RUN npm run build
7-
1+
ARG VERSION=latest
82
FROM node:22-alpine
9-
WORKDIR /app
10-
ENV NODE_ENV=production
11-
COPY --from=build /app/package.json /app/package.json
12-
COPY --from=build /app/package-lock.json /app/package-lock.json
13-
RUN npm ci --omit=dev --ignore-scripts
14-
COPY --from=build /app/dist /app/dist
15-
CMD ["node", "dist/index.js"]
3+
RUN npm install -g mongodb-mcp-server@${VERSION}
4+
CMD ["mongodb-mcp-server"]

0 commit comments

Comments
 (0)