Skip to content

Commit 985f786

Browse files
No self-contained dockerfile
1 parent 67bead0 commit 985f786

File tree

2 files changed

+57
-15
lines changed

2 files changed

+57
-15
lines changed

.github/workflows/release-docker.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ name: ci
33
on:
44
push:
55
branches: ["docker-build"]
6+
tags:
7+
- "v*"
8+
workflow_dispatch:
9+
inputs:
10+
revision:
11+
description: "Tag or revision to build binaries for"
12+
type: string
13+
required: true
14+
create_release:
15+
description: "Should publish the binary or not"
16+
required: true
17+
default: "false"
618

719
env:
820
REGISTRY_IMAGE: sourcegraph/scip-clang
@@ -15,8 +27,40 @@ jobs:
1527
include:
1628
- os: ubuntu-22.04-32core-graph-team-amd64
1729
platform: linux/amd64
30+
binary_name: scip-clang-x86_64-linux
1831
- os: ubuntu-22.04-32core-graph-team-arm64
1932
platform: linux/arm64
33+
binary_name: scip-clang-arm64-linux
34+
runs-on: ${{ matrix.os }}
35+
steps:
36+
- uses: bazel-contrib/setup-bazel@0.14.0
37+
with:
38+
bazelisk-cache: true
39+
disk-cache: ${{ github.workflow }}
40+
repository-cache: true
41+
42+
- name: Build binary
43+
run: bazel build //indexer:scip-clang --config release
44+
45+
- name: Upload artifacts
46+
uses: actions/upload-artifact@v4
47+
with:
48+
path: bazel-bin/indexer/scip-clang
49+
name: ${{ matrix.binary_name }}
50+
if-no-files-found: error
51+
52+
build-docker:
53+
needs: [build]
54+
strategy:
55+
fail-fast: false
56+
matrix:
57+
include:
58+
- os: ubuntu-22.04
59+
platform: linux/amd64
60+
binary_name: scip-clang-x86_64-linux
61+
- os: ubuntu-22.04-arm
62+
platform: linux/arm64
63+
binary_name: scip-clang-arm64-linux
2064
runs-on: ${{ matrix.os }}
2165
steps:
2266
- name: Prepare
@@ -46,6 +90,14 @@ jobs:
4690
- name: Set up Docker Buildx
4791
uses: docker/setup-buildx-action@v3
4892

93+
- name: Download pre-built binary
94+
uses: actions/download-artifact@v4
95+
with:
96+
name: ${{ matrix.binary_name }}
97+
path: /tmp/binary
98+
99+
- run: cp /tmp/binary/${{ matrix.binary_name }}/scip-clang ./scip-clang
100+
49101
- name: Build and push by digest
50102
id: build
51103
uses: docker/build-push-action@v6

Dockerfile

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,11 @@
1-
FROM ubuntu:22.04 as build
2-
3-
ARG BUILD_TYPE=release
4-
5-
# Install Bazelisk
6-
RUN apt-get update && apt-get install -y curl libc6-dev python3 build-essential ninja-build git cmake && \
7-
echo $(uname -p) && \
8-
curl -fsSL https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-$(uname -p | sed 's/aarch64/arm64/' | sed 's/x86_64/amd64/') > /usr/local/bin/bazel && \
9-
chmod +x /usr/local/bin/bazel
10-
11-
WORKDIR /sources
1+
FROM ubuntu:22.04 as indexer
122

13-
COPY . .
143

15-
RUN bazel build //... --config $BUILD_TYPE
4+
RUN apt-get update && apt-get install -y curl libc6-dev python3 build-essential ninja-build git cmake
165

17-
FROM ubuntu:22.04 as indexer
6+
COPY scip-clang /usr/bin/scip-clang
7+
RUN chmod +x /usr/bin/scip-clang && chown $(whoami) /usr/bin/scip-clang
188

19-
COPY --from=build /sources/bazel-bin/indexer/scip-clang /usr/local/bin/scip-clang
9+
WORKDIR /sources
2010

2111
ENTRYPOINT [ "scip-clang" ]

0 commit comments

Comments
 (0)