diff --git a/Dockerfile b/Dockerfile index 8b61d96..976c2c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,23 @@ -FROM golang:1.21.5@sha256:135ba6c2ae2a9a022f53f3eee24ef213bc62e876811cd9582b91045168206873 +# When updating the version of the base container, please use the +# SHA256 of the distribution manifest, not individual images. -COPY scip-go /usr/bin/ +# This ensures that when pulling the container, Docker will detect +# the platform and pull the correct image (if it exists) + +# For example, to find out the hash of the manfiest, run: + +# $ docker buildx imagetools inspect golang:1.21.5-alpine +# Name: docker.io/library/golang:1.21.5-alpine +# MediaType: application/vnd.docker.distribution.manifest.list.v2+json +# Digest: sha256:4db4aac30880b978cae5445dd4a706215249ad4f43d28bd7cdf7906e9be8dd6b +# And use this digest in FROM +FROM golang:1.21.5@sha256:4db4aac30880b978cae5445dd4a706215249ad4f43d28bd7cdf7906e9be8dd6b + +COPY . /sources +WORKDIR /sources +RUN go build -o scip-go ./cmd/scip-go + +FROM alpine:latest + +COPY --from=builder /sources/scip-go /usr/bin/ +CMD ["scip-go"] diff --git a/README.md b/README.md index 5e5bb13..92fa637 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,14 @@ scip-go src code-intel upload -github-token='${{ secrets.GITHUB_TOKEN }}' -no-progress ``` +## Docker + +To build a self-contained Docker container with the indexer, use +the following command: + +```bash +docker build -t scip-go:latest . +``` # Contributing