2024-03-14 16:25:30 +03:00
ARG PYTHON_VERSION = 3 .11
2023-05-04 08:35:22 +03:00
# pin Google Cloud SDK to old version due to https://stackoverflow.com/questions/76159439/job-failing-with-error-gcloud-crashed-attributeerror-bool-object-has-no-at
ARG GOOGLE_CLOUD_SDK_VERSION = 417 .0.0
2019-04-19 19:19:36 +03:00
2021-08-30 22:08:57 +03:00
# use buster image because the default bullseye image released 2021-08-17
# sha256:ffb6539b4b233743c62170989024c6f56dcefa69a83c4bd9710d4264b19a98c0
# has updated coreutils that require a newer linux kernel than provided by CircleCI, per
# https://forums.docker.com/t/multiple-projects-stopped-building-on-docker-hub-operation-not-permitted/92570/6
# and https://forums.docker.com/t/multiple-projects-stopped-building-on-docker-hub-operation-not-permitted/92570/11
2022-01-12 18:10:24 +03:00
# --platform=linux/amd64 added to prevent pulling ARM images when run on Apple Silicon
2021-11-04 22:53:23 +03:00
FROM --platform=linux/amd64 python:${PYTHON_VERSION}-slim-buster AS base
2021-08-30 22:08:57 +03:00
WORKDIR /app
2019-04-19 19:19:36 +03:00
# build typed-ast in separate stage because it requires gcc and libc-dev
2021-08-30 22:08:57 +03:00
FROM base AS python-deps
2020-02-12 22:26:24 +03:00
RUN apt-get update -qqy && apt-get install -qqy gcc libc-dev
COPY requirements.txt ./
2022-02-25 00:36:47 +03:00
# use --no-deps to work around https://github.com/pypa/pip/issues/9644
RUN pip install --no-deps -r requirements.txt
2019-04-19 19:19:36 +03:00
2023-05-04 08:35:22 +03:00
FROM google/cloud-sdk:${GOOGLE_CLOUD_SDK_VERSION}-alpine AS google-cloud-sdk
2021-08-30 22:08:57 +03:00
FROM base
2023-06-05 21:03:07 +03:00
# add bash for entrypoint
2024-06-14 03:38:41 +03:00
RUN mkdir -p /usr/share/man/man1 && apt-get update -qqy && apt-get install -qqy bash git jq
2023-05-04 08:35:22 +03:00
COPY --from= google-cloud-sdk /google-cloud-sdk /google-cloud-sdk
2019-04-19 19:19:36 +03:00
ENV PATH /google-cloud-sdk/bin:$PATH
2021-08-30 22:08:57 +03:00
COPY --from= python-deps /usr/local /usr/local
2019-05-01 23:38:31 +03:00
COPY .bigqueryrc /root/
2019-04-19 19:19:36 +03:00
COPY . .
2020-09-17 01:16:11 +03:00
RUN pip install .
2019-04-19 19:19:36 +03:00
ENTRYPOINT [ "/app/script/entrypoint" ]