Skip to content

Provide a single self-contained docker image, remove alpine #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 11, 2024
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
21 changes: 13 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
push:
tags:
- v*
branches:
- main

jobs:
release-image:
Expand All @@ -19,6 +21,7 @@ jobs:
- run: yarn run build
- run: du -h dist/src/main.js
- run: npm publish --access public
if: startsWith(github.ref, 'refs/tags/v')
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
- run: echo "PATCH=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
Expand All @@ -29,8 +32,17 @@ jobs:
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push
- name: Build and push snapshot
id: docker_build
if: github.ref == 'refs/heads/main'
uses: docker/build-push-action@v3
with:
push: true
tags: |
sourcegraph/scip-typescript:latest-snapshot
- name: Build and push tag
id: docker_build
if: startsWith(github.ref, 'refs/tags/v')
uses: docker/build-push-action@v3
with:
push: true
Expand All @@ -39,10 +51,3 @@ jobs:
sourcegraph/scip-typescript:${{ env.PATCH }}
sourcegraph/scip-typescript:${{ env.MINOR }}
sourcegraph/scip-typescript:${{ env.MAJOR }}
- name: Build and push
id: docker_build_autoindex
uses: docker/build-push-action@v3
with:
file: Dockerfile.autoindex
push: true
tags: sourcegraph/scip-typescript:autoindex
Comment on lines -46 to -48
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need a corresponding change in sg/sg to change the image we use for autoindexing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I will update the SHA in sg/sg to the sha of the new container (single one).
We only refer to indexing containers by sha, not name (in default settings anyways)

44 changes: 37 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
# Keep in sync with Dockerfile.autoindex
FROM node:20.8.1-alpine3.18@sha256:1ccb0c0ded3b21cee95fe6b6ce1ac23bd6680c8f152cbfb3047d5d9ea490b098
# When updating the version of the base container, please use the
# SHA256 listed under 'Index digest' on Docker Hub,
# not the 'Manifest digest'.
#
# This ensures that when pulling the container, Docker will detect
# the platform and pull the correct image (if it exists)
#
# Alternate way of determining the Index digest using the docker CLI.
#
# $ docker buildx imagetools inspect node:22.12.0-slim
# Name: docker.io/library/node:22.12.0-slim
# MediaType: application/vnd.oci.image.index.v1+json
# Digest: sha256:a4b757cd491c7f0b57f57951f35f4e85b7e1ad54dbffca4cf9af0725e1650cd8
# And use this digest in FROM
ARG base_sha=a4b757cd491c7f0b57f57951f35f4e85b7e1ad54dbffca4cf9af0725e1650cd8

ARG TAG
FROM node:22.12.0-slim@sha256:${base_sha}

RUN apk add --no-cache git curl
ENV NODE_OPTIONS=--max-old-space-size=4096

RUN yarn global add npm yarn
RUN apt update && \
apt install -y git bash curl ca-certificates python3 make build-essential automake autoconf curl && \
rm -rf /var/lib/apt/lists/* && \
npm install -g n yarn pnpm --force

RUN yarn global add @sourcegraph/scip-typescript@${TAG} @sourcegraph/src
WORKDIR /app

CMD ["/bin/sh"]
COPY . .
RUN npm install && npm run build && npm install -g .

WORKDIR /src

RUN mv /usr/local/bin/yarn /usr/local/bin/actual-yarn
COPY ./dev/lenient-yarn.sh /usr/local/bin/yarn

RUN mv /usr/local/bin/npm /usr/local/bin/actual-npm
COPY ./dev/lenient-npm.sh /usr/local/bin/npm

RUN mv /usr/local/bin/n /usr/local/bin/actual-n
COPY ./dev/lenient-n.sh /usr/local/bin/n

ENTRYPOINT ["scip-typescript"]
27 changes: 0 additions & 27 deletions Dockerfile.autoindex

This file was deleted.

Loading