Commit 84f5f868 authored by Vladislav Shishko (EPAM)'s avatar Vladislav Shishko (EPAM) Committed by Oleksandr Kosse (EPAM)
Browse files

(GONRG-1676) Cicd

parent 0af9502f
media
docs
variables:
PIP_REQUIREMENTS: "requirements.txt requirements_dev.txt"
OSDU_GCP_APPLICATION_NAME: wellbore-ddms
OSDU_GCP_SERVICE: wellbore-ddms
OSDU_GCP_ENV_VARS: CLOUD_PROVIDER=gcp,OS_WELLBORE_DDMS_DATA_PROJECT_ID=$OSDU_GCP_PROJECT,SERVICE_HOST_ENTITLEMENTS=$OSDU_GCP_ENTITLEMENTS_URL,SERVICE_HOST_SEARCH=$OSDU_GCP_SEARCH_HOST,SERVICE_HOST_STORAGE=$OSDU_GCP_STORAGE_URL
OSDU_GCP_CLOUD_RUN_PARAMETERS: "--port 8097"
OSDU_GCP_VENDOR: gcp
include:
- project: "osdu/platform/ci-cd-pipelines"
file: "standard-setup.yml"
......@@ -14,9 +20,11 @@ include:
- project: "osdu/platform/ci-cd-pipelines"
file: "scanners/gitlab-ultimate.yml"
- project: 'osdu/platform/ci-cd-pipelines'
file: 'cloud-providers/osdu-gcp-cloudrun.yml'
# --------------------------------------------------------------------------------
deploy:
containerize:
extends:
- .skipForTriggeringMergeRequests
......@@ -47,3 +55,21 @@ deploy:
- echo ---- ---- PUSH IMAGE
- docker push $IMAGE_TAG
- docker push $CI_REGISTRY_IMAGE:latest
osdu-gcp-containerize:
script:
- gcloud auth activate-service-account --key-file $OSDU_GCP_DEPLOY_FILE
- gcloud config set project $OSDU_GCP_PROJECT
- touch .gcloudignore
- docker build -t gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_APPLICATION_NAME-$OSDU_GCP_VENDOR:$CI_COMMIT_SHORT_SHA --rm . -f ./build/Dockerfile
- gcloud docker -- push gcr.io/$OSDU_GCP_PROJECT/$OSDU_GCP_APPLICATION_NAME/$OSDU_GCP_APPLICATION_NAME-$OSDU_GCP_VENDOR:$CI_COMMIT_SHORT_SHA
cache: { }
tags: [ 'osdu-medium' ]
osdu-gcp-test-python:
allow_failure: true
script:
- echo "STUB"; exit 1
osdu-gcp-test:
extends: []
{
"python.pythonPath": "/usr/bin/python3"
}
\ No newline at end of file
......@@ -9,6 +9,8 @@ The following software have components provided under the terms of this license:
- aiohttp (from https://github.com/aio-libs/aiohttp/)
- async-timeout (from https://github.com/aio-libs/async_timeout/)
- boto3 (from https://github.com/boto/boto3)
- botocore (from https://github.com/boto/botocore)
- coverage (from https://coverage.readthedocs.io)
- cryptography (from https://github.com/pyca/cryptography)
- google-api-core (from https://github.com/GoogleCloudPlatform/google-cloud-python)
......@@ -37,6 +39,7 @@ The following software have components provided under the terms of this license:
- requests (from http://python-requests.org)
- rfc3986 (from https://rfc3986.readthedocs.org)
- rsa (from https://stuvel.eu/rsa)
- s3transfer (from https://github.com/boto/s3transfer)
- sniffio (from https://github.com/python-trio/sniffio)
- structlog (from http://www.structlog.org/)
- yarl (from https://github.com/aio-libs/yarl/)
......@@ -178,12 +181,14 @@ The following software have components provided under the terms of this license:
- azure-keyvault-keys (from https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/keyvault/azure-keyvault-keys)
- azure-keyvault-secrets (from https://github.com/Azure/azure-sdk-for-python/tree/master/sdk/keyvault/azure-keyvault-secrets)
- azure-storage-blob (from https://github.com/Azure/azure-storage-python)
- botocore (from https://github.com/boto/botocore)
- cachetools (from https://github.com/tkem/cachetools)
- cffi (from http://cffi.readthedocs.org)
- coverage (from https://coverage.readthedocs.io)
- fastapi (from https://github.com/tiangolo/fastapi)
- h11 (from https://github.com/python-hyper/h11)
- iniconfig (from http://github.com/RonnyPfannschmidt/iniconfig)
- jmespath (from https://github.com/jmespath/jmespath.py)
- jsonschema (from http://github.com/Julian/jsonschema)
- mockito (from https://github.com/kaste/mockito-python)
- msal (from https://github.com/AzureAD/microsoft-authentication-library-for-python)
......@@ -254,6 +259,7 @@ public-domain
========================================================================
The following software have components provided under the terms of this license:
- botocore (from https://github.com/boto/botocore)
- coverage (from https://coverage.readthedocs.io)
- py (from http://pylib.readthedocs.org/)
- pytz (from http://pythonhosted.org/pytz)
......
......@@ -269,17 +269,14 @@ Then access app on `http://localhost:LOCAL_PORT/docs`
A Personal Access Token (PAT) is required to pull all the python packages.
```bash
USER=<username>
PAT=<PAT>
# Set PIP_EXTRA_URL
PIP_EXTRA_URL="<URL>"
PIP_EXTRA_URL=https://community.opengroup.org/groups/osdu/platform/domain-data-mgmt-services/wellbore/-/packages
# Set IMAGE_TAG
IMAGE_TAG="os-wellbore-ddms:dev"
# Build Image
docker build -t=$IMAGE_TAG --rm . -f ./build/dockerfile --build-arg PIP_EXTRA_URL=$PIP_EXTRA_URL --build-arg PIP_WHEEL_DIR=python-packages
docker build -t=$IMAGE_TAG --rm . -f ./build/Dockerfile --build-arg PIP_EXTRA_URL=$PIP_EXTRA_URL --build-arg PIP_WHEEL_DIR=python-packages
```
#### Run Image
......
##################################################################
# Create a first image with credentials. It will download the dep.
##################################################################
FROM python:3.7-slim-buster as build
WORKDIR /root/build_directory
LABEL maintainer="OSDU Wellbore data domain services team <WellboreDDMS@slb.com>"
COPY requirements.txt .
RUN pip wheel uvicorn --wheel-dir=python-packages
ARG PIP_EXTRA_URL
ARG PIP_WHEEL_DIR
RUN pip wheel -r requirements.txt --extra-index-url=$PIP_EXTRA_URL --wheel-dir=$PIP_WHEEL_DIR
#################################################################
# Create a second image without credentials
#################################################################
FROM python:3.7-slim-buster
RUN apt-get update && apt-get install -y git
COPY requirements.txt requirements_dev.txt ./
COPY --from=build /root/build_directory .
RUN pip install --force-reinstall --ignore-installed --upgrade --no-index --no-deps python-packages/*
RUN pip install -r requirements.txt
RUN pip install -r requirements_dev.txt
COPY ./app /app
ENV PYTHONPATH=./
......@@ -46,4 +27,3 @@ RUN addgroup --system appuser && adduser --system appuser && adduser appuser app
USER appuser
CMD ["uvicorn", "app.wdms_app:wdms_app", "--host", "0.0.0.0", "--port", "8097"]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment