Skip to content

Commit 5e83257

Browse files
committed
feat: docker support
1 parent ed131ad commit 5e83257

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

.github/workflows/docker.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# See RELEASING.md#DockerImage for more details about the steps in this workflow.
2+
name: Daily Release AtlasCLI Docker Image
3+
on:
4+
schedule:
5+
- cron: "0 1 * * *" # Every day at 1:00 AM
6+
workflow_dispatch: # Run the action manually
7+
pull_request: # TODO: delete this before merging
8+
jobs:
9+
build_images:
10+
name: Build and publish docker image to staging registry
11+
runs-on: ubuntu-latest
12+
env:
13+
IMAGE_REPOSITORY: docker.io/mongodb/apix_test
14+
TAG_PREFIX: mongodb-mcp-server
15+
steps:
16+
- uses: GitHubSecurityLab/actions-permissions/monitor@v1
17+
with:
18+
config: ${{ vars.PERMISSIONS_CONFIG }}
19+
- name: Check out code
20+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
21+
- name: Set properties
22+
id: set-properties
23+
run: |
24+
DATE=$(date +'%Y-%m-%d')
25+
VERSION=$(npm pkg get version | tr -d '"')
26+
echo "DATE=${DATE}" >> "$GITHUB_OUTPUT"
27+
echo "VERSION=${VERSION}" >> "$GITHUB_OUTPUT"
28+
- name: Set up Docker Buildx
29+
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
30+
- name: Login to Docker Hub
31+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
32+
with:
33+
username: "${{ secrets.DOCKERHUB_USER }}"
34+
password: "${{ secrets.DOCKERHUB_SECRET }}"
35+
- name: Build and push image to dockerhub staging registry
36+
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
37+
with:
38+
context: .
39+
platforms: linux/amd64,linux/arm64
40+
tags:
41+
${{ 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 }}
42+
file: Dockerfile
43+
push: true
44+
# - name: Create Issue
45+
# if: ${{ failure() }}
46+
# uses: imjohnbo/issue-bot@572eed14422c4d6ca37e870f97e7da209422f5bd
47+
# with:
48+
# labels: failed-release
49+
# title: Release Failure for Atlas CLI Docker Image ${{ env.TAG_PREFIX }}${{ steps.set-properties.outputs.VERSION }}-${{ steps.set-properties.outputs.DATE }}
50+
# body: See https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM node:22 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+
8+
FROM node:22
9+
WORKDIR /app
10+
COPY --from=build /app/package.json /app/package.json
11+
COPY --from=build /app/package-lock.json /app/package-lock.json
12+
COPY --from=build /app/dist dist
13+
RUN npm ci --omit=dev --ignore-scripts
14+
ENV NODE_ENV=production
15+
CMD ["node", "dist/index.js"]

0 commit comments

Comments
 (0)