diff --git a/.dockerignore b/.dockerignore index 2225cfac84cf53..f895335080a589 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,3 +6,5 @@ !/yarn.lock !/dist/requirements-frozen.txt !/dist/*.whl +# To allow local builds +!/requirements-frozen.txt diff --git a/docker/Dockerfile b/docker/Dockerfile index 59a6326e4030cd..5f06b9570d1080 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,6 @@ FROM python:3.8.13-slim-bullseye +# The Cloud build uses /dist as a place to cache wheels and others +ARG DIST_DIR=. LABEL maintainer="oss@sentry.io" LABEL org.opencontainers.image.title="Sentry" @@ -48,7 +50,7 @@ ENV \ GRPC_POLL_STRATEGY=epoll1 # Install dependencies first to leverage Docker layer caching. -COPY /dist/requirements-frozen.txt /tmp/requirements-frozen.txt +COPY ${DIST_DIR}/requirements-frozen.txt /tmp/requirements-frozen.txt RUN set -x \ && buildDeps="" \ # uwsgi @@ -67,7 +69,11 @@ RUN set -x \ " \ && apt-get update \ && apt-get install -y --no-install-recommends $buildDeps \ + # HACK: Using our own builds of these + && pip install --index-url https://pypi.devinfra.sentry.io/simple confluent-kafka==1.9.2 psycopg2-binary==2.8.6 \ && pip install -r /tmp/requirements-frozen.txt \ + # HACK: Installing Sentry here since we don't have access to wheels in /dist + && pip install sentry \ && mkdir /tmp/uwsgi-dogstatsd \ && wget -O - https://github.com/eventbrite/uwsgi-dogstatsd/archive/filters-and-tags.tar.gz | \ tar -xzf - -C /tmp/uwsgi-dogstatsd --strip-components=1 \ @@ -103,8 +109,9 @@ RUN set -x \ && python -c 'import maxminddb.extension; maxminddb.extension.Reader' \ && mkdir -p $SENTRY_CONF -COPY /dist/*.whl /tmp/dist/ -RUN pip install /tmp/dist/*.whl --no-deps && pip check && rm -rf /tmp/dist +# HACK: We do not have access to /dist; doing pip install sentry up above +# COPY /dist/*.whl /tmp/dist/ +# RUN pip install /tmp/dist/*.whl --no-deps && pip check && rm -rf /tmp/dist RUN sentry help | sed '1,/Commands:/d' | awk '{print $1}' > /sentry-commands.txt COPY ./docker/sentry.conf.py ./docker/config.yml $SENTRY_CONF/ diff --git a/docker/cloudbuild.yaml b/docker/cloudbuild.yaml index 6f99dce91e5fa7..47f23dafaf3dca 100644 --- a/docker/cloudbuild.yaml +++ b/docker/cloudbuild.yaml @@ -7,6 +7,8 @@ steps: '--use-new-run', '--build-arg', 'SOURCE_COMMIT=$COMMIT_SHA', + '--build-arg', + 'DIST_DIR=/dist', '--destination=us.gcr.io/$PROJECT_ID/sentry-builder:$COMMIT_SHA', '-f', './docker/builder.dockerfile',