|
| 1 | +FROM golang:1.23.7 AS build |
| 2 | +# Set the working directory |
| 3 | +WORKDIR /build |
| 4 | +# Copy the current directory contents into the working directory |
| 5 | +COPY . . |
| 6 | +# Install dependencies |
| 7 | +RUN go mod download |
| 8 | +# Build the server |
| 9 | +RUN go build -o github-mcp-server cmd/github-mcp-server/main.go |
| 10 | +# Make a stage to run the app |
| 11 | +FROM golang:1.23.7 |
| 12 | +# Set the working directory |
| 13 | +WORKDIR /server |
| 14 | +# Copy the binary from the build stage |
| 15 | +COPY --from=build /build/github-mcp-server . |
| 16 | +# Switch to a non-root user |
| 17 | +RUN adduser --disabled-password --gecos'' appuser |
| 18 | + |
| 19 | +RUN chown -R appuser:appuser /server |
| 20 | +RUN chmod +x /server/github-mcp-server |
| 21 | +USER appuser |
| 22 | +# TODO no http server yet |
| 23 | +# Expose the port the app runs on |
| 24 | +EXPOSE 8080 |
| 25 | +# Command to run the server |
| 26 | +CMD ["./github-mcp-server","stdio"] |