From 37da890d9ba75c5a29e5c644d3682f6574f2b1c0 Mon Sep 17 00:00:00 2001 From: Lav Jain Date: Wed, 16 Aug 2023 18:55:22 -0400 Subject: [PATCH] Common dockerfile based on cloud-learning-platform --- .../{{'common' if has_common}}/Dockerfile | 27 +++++++++++++--- .../Dockerfile.unittest | 31 ++++++++++++++----- .../requirements-test.txt | 12 +++---- .../requirements.txt | 15 ++++++--- 4 files changed, 62 insertions(+), 23 deletions(-) diff --git a/solutions_builder/template_root/components/{{'common' if has_common}}/Dockerfile b/solutions_builder/template_root/components/{{'common' if has_common}}/Dockerfile index 19160e82..9d300af9 100644 --- a/solutions_builder/template_root/components/{{'common' if has_common}}/Dockerfile +++ b/solutions_builder/template_root/components/{{'common' if has_common}}/Dockerfile @@ -1,12 +1,29 @@ -FROM python:3.9-slim +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM python:3.9.14-slim + WORKDIR /opt -# needed for backports-datetime-fromisoformat in fireo -RUN apt-get update -RUN apt-get -y install gcc +RUN apt-get update && apt-get -y upgrade && \ + apt-get -y install gcc vim && \ + apt-get autoremove -yqq --purge && apt-get clean COPY requirements.txt . -RUN pip install -r requirements.txt +RUN pip install --upgrade pip && \ + pip install -r requirements.txt && \ + rm -Rf /root/.cache/pip COPY src/ . diff --git a/solutions_builder/template_root/components/{{'common' if has_common}}/Dockerfile.unittest b/solutions_builder/template_root/components/{{'common' if has_common}}/Dockerfile.unittest index 12369fe0..690ffdc2 100644 --- a/solutions_builder/template_root/components/{{'common' if has_common}}/Dockerfile.unittest +++ b/solutions_builder/template_root/components/{{'common' if has_common}}/Dockerfile.unittest @@ -1,14 +1,31 @@ -# changed from slim for FireO -FROM python:3.9-slim +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +FROM python:3.9.14-slim + WORKDIR /opt -# needed for backports-datetime-fromisoformat in fireo -RUN apt-get update -RUN apt-get -y install gcc +RUN apt-get update && apt-get -y upgrade && \ + apt-get -y install gcc vim && \ + apt-get autoremove -yqq --purge && apt-get clean -COPY requirements.txt . -COPY requirements-test.txt . +COPY requirements*.txt . +RUN pip install --upgrade pip && \ + pip install -r requirements.txt && \ + pip install -r requirements-test.txt && \ + rm -Rf /root/.cache/pip RUN pip install -r requirements.txt RUN pip install -r requirements-test.txt diff --git a/solutions_builder/template_root/components/{{'common' if has_common}}/requirements-test.txt b/solutions_builder/template_root/components/{{'common' if has_common}}/requirements-test.txt index 1458948f..dc1f2a37 100644 --- a/solutions_builder/template_root/components/{{'common' if has_common}}/requirements-test.txt +++ b/solutions_builder/template_root/components/{{'common' if has_common}}/requirements-test.txt @@ -1,6 +1,6 @@ -backports-unittest-mock -mock -pylint -pytest -pytest-cov -pytest-custom_exit_code \ No newline at end of file +pylint==2.17.2 +pytest-cov==4.0.0 +pytest-custom_exit_code==0.3.0 +pytest-mock==3.10.0 +pytest==7.2.0 +pytz==2023.3 diff --git a/solutions_builder/template_root/components/{{'common' if has_common}}/requirements.txt b/solutions_builder/template_root/components/{{'common' if has_common}}/requirements.txt index 7d8266a9..7341d99a 100644 --- a/solutions_builder/template_root/components/{{'common' if has_common}}/requirements.txt +++ b/solutions_builder/template_root/components/{{'common' if has_common}}/requirements.txt @@ -1,6 +1,11 @@ -fireo==1.4.1 -google-cloud-bigquery==2.20.0 -google-cloud-logging -google-cloud-secret-manager==2.5.0 -jsonschema==3.2.0 +fastapi==0.85.1 +fireo==1.6.2 +google-api-python-client==2.91.0 +google-cloud-bigquery==3.10.0 +google-cloud-logging==3.5.0 +google-cloud-secret-manager==2.16.1 +jsonschema==4.17.3 +gcsfs==2023.6.0 +kubernetes==27.2.0 pandas==1.2.4 +regex==2023.6.3