Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,40 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
- name: Build base image (not published)
id: docker_build_base
uses: docker/build-push-action@v6
with:
file: Dockerfile.base
push: false
load: true
build-args: |
SCIP_RUBY_VERSION=${{ env.PATCH }}
tags: |
scip-ruby-base:${{ env.PATCH }}
- name: Build and push autoindex image
id: docker_build_autoindex
uses: docker/build-push-action@v6
with:
file: Dockerfile.autoindex
push: true
build-args: |
BASE_TAG=${{ env.PATCH }}
tags: |
sourcegraph/scip-ruby:autoindex
sourcegraph/scip-ruby:autoindex-${{ env.PATCH }}
sourcegraph/scip-ruby:autoindex-${{ env.MINOR }}
sourcegraph/scip-ruby:autoindex-${{ env.MAJOR }}
- name: Build and push scip-ruby image
id: docker_build_scip_ruby
uses: docker/build-push-action@v6
with:
file: Dockerfile
push: true
build-args: |
BASE_TAG=${{ env.PATCH }}
tags: |
sourcegraph/scip-ruby:latest
sourcegraph/scip-ruby:${{ env.PATCH }}
sourcegraph/scip-ruby:${{ env.MINOR }}
sourcegraph/scip-ruby:${{ env.MAJOR }}
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Build from the base image (local, not published)
ARG BASE_TAG
FROM scip-ruby-base:${BASE_TAG}

# This Docker image provides scip-ruby for CI/CD pipelines

# Default command is to run scip-ruby
CMD ["scip-ruby"]
17 changes: 5 additions & 12 deletions Dockerfile.autoindex
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
FROM --platform=linux/amd64 ruby:2.7.6-alpine3.16@sha256:b014cf3e792d7130daec772241a211c40be009fc7f00e2b728ffe26805649575
# Build from the base image (local, not published)
ARG BASE_TAG
FROM scip-ruby-base:${BASE_TAG}

# This Docker image is meant for auto-indexing support in Sourcegraph
# and is not recommended for third-party use.

# gcompat is a glibc-musl compat library (scip-ruby links in glibc)
# Other deps are to help build C extensions in gems.
RUN apk add --no-cache bash wget make libstdc++ gcc g++ automake autoconf gcompat git

# Use a release binary instead of building from source
# because release builds are very time-consuming.
#
# The release version is verified by tools/scripts/publish-scip-ruby.sh
RUN wget https://github.com/sourcegraph/scip-ruby/releases/download/scip-ruby-v0.4.6/scip-ruby-x86_64-linux -O /usr/bin/scip-ruby && chmod +x /usr/bin/scip-ruby

# Copy and install the autoindex script
COPY scip_indexer/autoindex.sh /usr/bin/scip-ruby-autoindex

RUN chmod +x /usr/bin/scip-ruby-autoindex

# Default command is shell for autoindex operations
CMD ["/bin/sh"]
39 changes: 39 additions & 0 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM --platform=linux/amd64 \
ruby:2.7.6-alpine3.16@sha256:b014cf3e792d7130daec772241a211c40be009fc7f00e2b728ffe26805649575

# This is the base Docker image for scip-ruby with common dependencies

# Version argument to be passed during build
ARG SCIP_RUBY_VERSION

# Fail if SCIP_RUBY_VERSION is not provided
RUN test -n "${SCIP_RUBY_VERSION}" || \
(echo "ERROR: SCIP_RUBY_VERSION build arg is required" && exit 1)

# gcompat is a glibc-musl compat library (scip-ruby links in glibc)
# Other deps are to help build C extensions in gems.
RUN apk add --no-cache \
bash \
wget \
make \
libstdc++ \
gcc \
g++ \
automake \
autoconf \
gcompat \
git

# Use a release binary instead of building from source
# because release builds are very time-consuming.
#
# The release version is verified by tools/scripts/publish-scip-ruby.sh
# The binary at this version is guaranteed to exist because this workflow runs either:
# 1. Manually with a specific tag that already has a release
# 2. After the Release workflow completes (which creates the release and uploads the binary)
RUN wget https://github.com/sourcegraph/scip-ruby/releases/download/scip-ruby-v${SCIP_RUBY_VERSION}/scip-ruby-x86_64-linux \
Comment on lines +30 to +34
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is going to break, because the version number is no longer hard-coded in the URL, so the publishing script cannot cross-check this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow. The publishing step building this image sets SCIP_RUBY_VERSION=${{ env.PATCH }}.

In case this value is not passed we can return an error:

RUN test -n "${SCIP_RUBY_VERSION}" || \
    (echo "ERROR: SCIP_RUBY_VERSION build arg is required" && exit 1)

-O /usr/bin/scip-ruby && \
chmod +x /usr/bin/scip-ruby

# Set working directory for sources
WORKDIR /sources
Loading