/
githubmirror
/
oppia
Обзор
Документация
Войти
/
githubmirror
/
oppia
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
v3.3.4
docker/Dockerfile.backend
94 строки
4 KB
Shivkant Chauhan
[GSoC'23] - M1.4.2 - migrating local tests under docker (#18775)
21 окт 2023, 16:33
Не верифицирован
21 окт 2023, 16:33
f50e600
Код
Авторство
О чём код?
# Added platform flag here because -- https://stackoverflow.com/questions/71040681/qemu-x86-64-could-not-open-lib64-ld-linux-x86-64-so-2-no-such-file-or-direc FROM --platform=linux/amd64 python:3.8.17-slim-buster AS backend ENV OPPIA_IS_DOCKERIZED="true" WORKDIR / # Installing the pre-requisites libs and dependencies RUN apt-get update -y && apt-get upgrade -y \ curl \ git \ npm \ openjdk-11-jre \ python2 \ python3-matplotlib \ unzip \ wget RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - RUN apt-get install -y nodejs RUN curl -L -o google-chrome.deb https://github.com/webnicer/chrome-downloads/raw/master/x64.deb/google-chrome-stable_117.0.5938.149-1_amd64.deb RUN apt-get install -y ./google-chrome.deb RUN rm google-chrome.deb RUN pip install --upgrade pip==21.2.3 RUN pip install pip-tools==6.6.2 setuptools==58.5.3 cmake # Installing google cloud sdk RUN wget -O gcloud-sdk.tar.gz https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-364.0.0-linux-x86_64.tar.gz && \ tar -xzf gcloud-sdk.tar.gz && \ ./google-cloud-sdk/install.sh --quiet && \ rm gcloud-sdk.tar.gz WORKDIR /app/oppia ENV BUF_LINUX_FILES="buf-Linux-x86_64 protoc-gen-buf-check-lint-Linux-x86_64 protoc-gen-buf-check-breaking-Linux-x86_64" \ PROTOC_LINUX_FILE='protoc-3.13.0-linux-x86_64.zip' \ BUF_DIR='/app/buf-0.29.0' \ PROTOC_DIR='/app/buf-0.29.0/protoc' \ BUF_BASE_URL='https://github.com/bufbuild/buf/releases/download/v0.29.0/' \ PROTOC_URL='https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0' \ PROTOC_FILES_PATH='/app/oppia/third_party/oppia-ml-proto-0.0.0' RUN npm install protoc-gen-ts@0.3.4 google-protobuf@3.13.0 typescript@4.1.6 # Download BUF_LINUX_FILES and PROTOC_LINUX_FILE RUN wget -P $BUF_DIR $PROTOC_URL/$PROTOC_LINUX_FILE RUN unzip $BUF_DIR/$PROTOC_LINUX_FILE -d $PROTOC_DIR \ && rm $BUF_DIR/$PROTOC_LINUX_FILE # Set the shell as /bin/bash explicitly. This is required to make use of the array syntax correctly SHELL ["/bin/bash", "-c"] RUN IFS=' ' read -ra BUF_FILES <<< "$BUF_LINUX_FILES"; \ for bin_file in "${BUF_FILES[@]}"; do \ wget -P $BUF_DIR $BUF_BASE_URL/$bin_file; \ done RUN chmod -R 744 $BUF_DIR \ && chmod -R 744 $PROTOC_DIR # Installing python dependencies from the requirements_dev.txt file COPY requirements.txt . COPY requirements_dev.txt . COPY mypy_requirements.txt . RUN pip install --require-hashes --no-deps -r requirements.txt -t /app/oppia/third_party/python_libs RUN pip install --require-hashes --no-deps -r requirements_dev.txt RUN pip install -r mypy_requirements.txt -t /app/oppia/third_party/python3_libs RUN pip download --no-deps -r requirements.txt -d /root/.cache RUN pip download --no-deps -r requirements_dev.txt -d /root/.cache RUN pip download -r mypy_requirements.txt -d /root/.cache # Installing buf and proto for Linux -- this docker container is based on Linux COPY buf.gen.yaml . COPY /extensions/classifiers/proto/ ./extensions/classifiers/proto/ # Installing third party dependencies COPY scripts/install_dependencies_json_packages.py ./scripts/install_dependencies_json_packages.py COPY dependencies.json . # Installation for proto buf requires the third party dependencies to be installed (oppia-ml-proto) # This also downloads frontend dependencies, which should be removed once the dependencies.json is deprecated RUN python -m scripts.install_dependencies_json_packages # Compiling the protobuf files RUN mkdir /app/oppia/proto_files RUN /app/buf-0.29.0/protoc/bin/protoc \ --plugin=protoc-gen-ts=/app/oppia/node_modules/.bin/protoc-gen-ts \ --ts_out=/app/oppia/extensions/classifiers/proto/ \ --js_out=import_style=commonjs,binary:/app/oppia/extensions/classifiers/proto/ \ --python_out=/app/oppia/proto_files \ --proto_path=$PROTOC_FILES_PATH \ $PROTOC_FILES_PATH/*.proto RUN sed -i 's/import text_classifier_pb2 as text__classifier__pb2/from . import text_classifier_pb2 as text__classifier__pb2/' /app/oppia/proto_files/training_job_response_payload_pb2.py