chore: add Dockerfile and CI/CD workflow for Docker image builds
Build and Push Docker Image / build (push) Failing after 10s
Build and Push Docker Image / build (push) Failing after 10s
This commit is contained in:
2 files changed
+72
-30
No files matched your search
+16
-30
@@ -1,38 +1,24 @@
|
||||
FROM node:alpine@sha256:5209bcaca9836eb3448b650396213dbe9d9a34d31840c2ae1f206cb2986a8543 AS builder
|
||||
|
||||
RUN apk add --no-cache openssl=3.5.8-r0
|
||||
FROM node:22-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./package.json ./package.json
|
||||
COPY ./package-lock.json ./package-lock.json
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache git
|
||||
|
||||
RUN npm ci --ignore-scripts
|
||||
# Clone and install dependencies
|
||||
RUN git clone https://github.com/brave/brave-search-mcp-server.git . && \
|
||||
npm ci --only=production && \
|
||||
npm run build
|
||||
|
||||
COPY ./src ./src
|
||||
COPY ./tsconfig.json ./tsconfig.json
|
||||
# Remove git since we don't need it in runtime
|
||||
RUN apk del git
|
||||
|
||||
RUN npm run build
|
||||
# Expose the MCP server port
|
||||
EXPOSE 3000
|
||||
|
||||
FROM node:alpine@sha256:5209bcaca9836eb3448b650396213dbe9d9a34d31840c2ae1f206cb2986a8543 AS release
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
|
||||
CMD node -e "require('http').get('http://localhost:3000/health', (r) => process.exit(r.statusCode === 200 ? 0 : 1))"
|
||||
|
||||
RUN apk add --no-cache openssl=3.5.8-r0
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/dist /app/dist
|
||||
COPY --from=builder /app/package.json /app/package.json
|
||||
COPY --from=builder /app/package-lock.json /app/package-lock.json
|
||||
|
||||
ENV NODE_ENV=production
|
||||
|
||||
# The server defaults to binding 127.0.0.1 for safe local execution. Inside a
|
||||
# container the port must be reachable through the published mapping, so bind to
|
||||
# all interfaces here. Deployments can still override BRAVE_MCP_HOST.
|
||||
ENV BRAVE_MCP_HOST=0.0.0.0
|
||||
|
||||
RUN npm ci --ignore-scripts --omit-dev
|
||||
|
||||
USER node
|
||||
|
||||
ENTRYPOINT ["node", "dist/index.js"]
|
||||
# Start the MCP server
|
||||
CMD ["npm", "start"]
|
||||
Reference in new issue
Block a user