diff --git a/cmd/symbols/Dockerfile b/cmd/symbols/Dockerfile deleted file mode 100644 index a72a5306bc0..00000000000 --- a/cmd/symbols/Dockerfile +++ /dev/null @@ -1,91 +0,0 @@ -# NOTE: This layer of the docker image is also used in local development as a wrapper around universal-ctags -FROM sourcegraph/alpine-3.14:213466_2023-04-17_5.0-bdda34a71619@sha256:6354a4ff578b685e36c8fbde81f62125ae0011b047fb2cc22d1b0de616b3c59a AS ctags -# hadolint ignore=DL3002 -COPY cmd/symbols/ctags-install-alpine.sh /ctags-install-alpine.sh -RUN /ctags-install-alpine.sh - -FROM rust:1.73.0-alpine3.18@sha256:200be646c656b180aa9cf6cee1766f05fcf5bb0b94cf2900beeedca3bdf4016d as scip-ctags -# hadolint ignore=DL3002 -USER root -RUN apk add --no-cache musl-dev>=1.1.24-r10 build-base -COPY docker-images/syntax-highlighter /repo -WORKDIR /repo -RUN cargo fetch - -ARG TARGETARCH - -# Because .cargo/config.toml doesnt support triplet-specific env -COPY cmd/symbols/cargo-config.sh /cargo-config.sh -RUN /cargo-config.sh - -RUN cargo rustc --release --bin scip-ctags - -RUN cp ./target/release/scip-ctags /usr/local/bin/scip-ctags - -FROM golang:1.19.8-alpine@sha256:841c160ed35923d96c95c52403c4e6db5decd9cbce034aa851e412ade5d4b74f AS symbols-build -# hadolint ignore=DL3002 -USER root - -ENV GO111MODULE on -ENV GOARCH amd64 -ENV GOOS linux -ENV CGO_ENABLED 1 - -RUN apk add --no-cache gcc g++ - -COPY . /repo - -WORKDIR /repo - -ARG VERSION="unknown" -ENV VERSION $VERSION - -ARG PKG -ENV PKG=$PKG - -RUN \ - --mount=type=cache,target=/root/.cache/go-build \ - --mount=type=cache,target=/root/go/pkg/mod \ - go build \ - -trimpath \ - -ldflags "-X github.com/sourcegraph/sourcegraph/internal/version.version=$VERSION -X github.com/sourcegraph/sourcegraph/internal/version.timestamp=$(date +%s)" \ - -buildmode exe \ - -tags dist \ - -o /symbols \ - $PKG - -FROM sourcegraph/alpine-3.14:213466_2023-04-17_5.0-bdda34a71619@sha256:6354a4ff578b685e36c8fbde81f62125ae0011b047fb2cc22d1b0de616b3c59a AS symbols - -# TODO(security): This container should not run as root! -# -# See https://github.com/sourcegraph/sourcegraph/issues/13237 -# hadolint ignore=DL3002 -USER root - -ARG COMMIT_SHA="unknown" -ARG DATE="unknown" -ARG VERSION="unknown" - -LABEL org.opencontainers.image.revision=${COMMIT_SHA} -LABEL org.opencontainers.image.created=${DATE} -LABEL org.opencontainers.image.version=${VERSION} -LABEL com.sourcegraph.github.url=https://github.com/sourcegraph/sourcegraph/commit/${COMMIT_SHA} - -# ctags is dynamically linked against jansson -# libstdc++ and libgcc are for tree-sitter -RUN apk add --no-cache bind-tools ca-certificates mailcap tini jansson libstdc++ libgcc - -COPY --from=ctags /usr/local/bin/universal-ctags /usr/local/bin/universal-ctags -COPY --from=scip-ctags /usr/local/bin/scip-ctags /usr/local/bin/scip-ctags - -COPY --from=symbols-build /symbols /usr/local/bin/symbols - -# symbols is cgo, ensure we have the requisite dynamic libraries -RUN env SANITY_CHECK=true /usr/local/bin/symbols - -# Use SYMBOLS_CACHE_DIR to set the cache dir at runtime for the symbols service. Setting CACHE_DIR -# will also apply to other services and is deprecated. -ENV CACHE_DIR=/mnt/cache/symbols -RUN mkdir -p ${CACHE_DIR} -EXPOSE 3184 -ENTRYPOINT ["/sbin/tini", "--", "/usr/local/bin/symbols"] diff --git a/cmd/symbols/build-ctags.sh b/cmd/symbols/build-ctags.sh deleted file mode 100755 index d328983c692..00000000000 --- a/cmd/symbols/build-ctags.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -# This script builds the ctags images for local development. - -cd "$(dirname "${BASH_SOURCE[0]}")/../.." -set -eu - -# If CTAGS_COMMAND is set to a custom executable, we don't need to build the -# image. See /dev/universal-ctags-dev. - -if [[ "${CTAGS_COMMAND}" != "dev/universal-ctags-dev" ]]; then - echo "CTAGS_COMMAND set to custom executable. Building of Docker image not necessary." -else - # Check if we need to build the image or not - TARGET=$("./dev/ctags-install.sh" which) - - if [ ! -f "${TARGET}" ]; then - echo "CTAGS_COMMAND is not yet available. Building docker container." - echo "You can speed up this command by running ./dev/ctags-install." - - # Build ctags docker image for universal-ctags-dev - echo "Building universal-ctags docker image" - docker build -f cmd/symbols/Dockerfile -t ctags . \ - --platform linux/amd64 \ - --target=ctags \ - --progress=plain - else - echo "Found prebuilt universal-ctags binary" - fi -fi - -# If SCIP_CTAGS_COMMAND is set to a custom executable, we don't need to build the -# image. See /dev/scip-ctags-dev. -if [[ "${SCIP_CTAGS_COMMAND}" != "dev/scip-ctags-dev" ]]; then - echo "SCIP_CTAGS_COMMAND set to custom executable. Building of Docker image or Rust code not necessary." -else - # Check if we need to build the image or not - TARGET=$("./dev/scip-ctags-install.sh" which) - if [ ! -f "${TARGET}" ]; then - echo "SCIP_CTAGS_COMMAND is not yet available. Building docker container." - echo "You can speed up this command by running ./dev/ctags-install." - - if [[ "$(uname -m)" == "arm64" ]]; then - # build ctags with cargo; prevent x86-64 slowdown on mac - root="$(dirname "${BASH_SOURCE[0]}")/../.." >/dev/null - "$root"/dev/scip-ctags-install.sh - else - # Build ctags docker image for scip-ctags-dev - echo "Building scip-ctags docker image" - docker build -f cmd/symbols/Dockerfile -t scip-ctags . \ - --platform linux/amd64 \ - --target=scip-ctags \ - --progress=plain - fi - else - echo "Found prebuilt scip-ctags binary" - fi -fi diff --git a/cmd/symbols/build.sh b/cmd/symbols/build.sh deleted file mode 100644 index 4d9c5df060e..00000000000 --- a/cmd/symbols/build.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -# This script builds the symbols docker image. - -cd "$(dirname "${BASH_SOURCE[0]}")/../.." -set -eu - -echo "--- docker build symbols" -docker build -f cmd/symbols/Dockerfile -t "$IMAGE" "$(pwd)" \ - --progress=plain \ - --build-arg COMMIT_SHA \ - --build-arg DATE \ - --build-arg VERSION \ - --build-arg PKG="${PKG:-github.com/sourcegraph/sourcegraph/cmd/symbols}"