Skip to content

Commit d26abb6

Browse files
jupblbampagent
andcommitted
Add standalone scip-ruby Docker image for CI/CD
- Split Docker configuration into three files: - Dockerfile.base: Common dependencies and scip-ruby binary - Dockerfile: Standard scip-ruby image for CI/CD pipelines - Dockerfile.autoindex: Autoindex variant with additional script - Update GitHub Actions workflow to build base image locally (not published) - Both final images (scip-ruby and autoindex) are published to Docker Hub - New image can be used in CI: docker run -v $(pwd):/sources sourcegraph/scip-ruby Amp-Thread-ID: https://ampcode.com/threads/T-93250ea7-f00b-492f-ba56-04da7ddfe7d9 Co-authored-by: Amp <amp@ampcode.com>
1 parent 8d18448 commit d26abb6

4 files changed

Lines changed: 75 additions & 13 deletions

File tree

‎.github/workflows/publish-docker.yml‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,40 @@ jobs:
4242
with:
4343
username: ${{ secrets.DOCKER_USERNAME }}
4444
password: ${{ secrets.DOCKER_PASSWORD }}
45-
- name: Build and push
45+
- name: Build base image (not published)
46+
id: docker_build_base
47+
uses: docker/build-push-action@v6
48+
with:
49+
file: Dockerfile.base
50+
push: false
51+
load: true
52+
build-args: |
53+
SCIP_RUBY_VERSION=${{ env.PATCH }}
54+
tags: |
55+
scip-ruby-base:${{ env.PATCH }}
56+
- name: Build and push autoindex image
4657
id: docker_build_autoindex
4758
uses: docker/build-push-action@v6
4859
with:
4960
file: Dockerfile.autoindex
5061
push: true
62+
build-args: |
63+
BASE_TAG=${{ env.PATCH }}
5164
tags: |
5265
sourcegraph/scip-ruby:autoindex
5366
sourcegraph/scip-ruby:autoindex-${{ env.PATCH }}
5467
sourcegraph/scip-ruby:autoindex-${{ env.MINOR }}
5568
sourcegraph/scip-ruby:autoindex-${{ env.MAJOR }}
69+
- name: Build and push scip-ruby image
70+
id: docker_build_scip_ruby
71+
uses: docker/build-push-action@v6
72+
with:
73+
file: Dockerfile
74+
push: true
75+
build-args: |
76+
BASE_TAG=${{ env.PATCH }}
77+
tags: |
78+
sourcegraph/scip-ruby:latest
79+
sourcegraph/scip-ruby:${{ env.PATCH }}
80+
sourcegraph/scip-ruby:${{ env.MINOR }}
81+
sourcegraph/scip-ruby:${{ env.MAJOR }}

‎Dockerfile‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Build from the base image (local, not published)
2+
ARG BASE_TAG
3+
FROM scip-ruby-base:${BASE_TAG}
4+
5+
# This Docker image provides scip-ruby for CI/CD pipelines
6+
7+
# Default command is to run scip-ruby
8+
CMD ["scip-ruby"]

‎Dockerfile.autoindex‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
1-
FROM --platform=linux/amd64 ruby:2.7.6-alpine3.16@sha256:b014cf3e792d7130daec772241a211c40be009fc7f00e2b728ffe26805649575
1+
# Build from the base image (local, not published)
2+
ARG BASE_TAG
3+
FROM scip-ruby-base:${BASE_TAG}
24

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

6-
# gcompat is a glibc-musl compat library (scip-ruby links in glibc)
7-
# Other deps are to help build C extensions in gems.
8-
RUN apk add --no-cache bash wget make libstdc++ gcc g++ automake autoconf gcompat git
9-
10-
# Use a release binary instead of building from source
11-
# because release builds are very time-consuming.
12-
#
13-
# The release version is verified by tools/scripts/publish-scip-ruby.sh
14-
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
15-
8+
# Copy and install the autoindex script
169
COPY scip_indexer/autoindex.sh /usr/bin/scip-ruby-autoindex
17-
1810
RUN chmod +x /usr/bin/scip-ruby-autoindex
1911

12+
# Default command is shell for autoindex operations
2013
CMD ["/bin/sh"]

‎Dockerfile.base‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
FROM --platform=linux/amd64 \
2+
ruby:2.7.6-alpine3.16@sha256:b014cf3e792d7130daec772241a211c40be009fc7f00e2b728ffe26805649575
3+
4+
# This is the base Docker image for scip-ruby with common dependencies
5+
6+
# Version argument to be passed during build
7+
ARG SCIP_RUBY_VERSION
8+
9+
# gcompat is a glibc-musl compat library (scip-ruby links in glibc)
10+
# Other deps are to help build C extensions in gems.
11+
RUN apk add --no-cache \
12+
bash \
13+
wget \
14+
make \
15+
libstdc++ \
16+
gcc \
17+
g++ \
18+
automake \
19+
autoconf \
20+
gcompat \
21+
git
22+
23+
# Use a release binary instead of building from source
24+
# because release builds are very time-consuming.
25+
#
26+
# The release version is verified by tools/scripts/publish-scip-ruby.sh
27+
# The binary at this version is guaranteed to exist because this workflow runs either:
28+
# 1. Manually with a specific tag that already has a release
29+
# 2. After the Release workflow completes (which creates the release and uploads the binary)
30+
RUN wget https://github.com/sourcegraph/scip-ruby/releases/download/scip-ruby-v${SCIP_RUBY_VERSION}/scip-ruby-x86_64-linux \
31+
-O /usr/bin/scip-ruby && \
32+
chmod +x /usr/bin/scip-ruby
33+
34+
# Set working directory for sources
35+
WORKDIR /sources

0 commit comments

Comments
 (0)