Skip to content

Commit

Permalink
ENV variables + docker push
Browse files Browse the repository at this point in the history
  • Loading branch information
fvolz committed Oct 1, 2024
1 parent eb5aa76 commit 2256fb6
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 13 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

name: ci

on:
push:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# You can test your matrix by printing the current Python version
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r req.txt
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Registry
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build and push docker image
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
push: true
tags: fraunhoferiosb/fx-ccm-dataspace-poc-machine-builder-condition-service:latest
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Compiled class file
*.class

# Ignore Gradle build output directory
build

.idea
.vs
.vscode

/secrets

# Log file
*.log

Expand Down
21 changes: 8 additions & 13 deletions app/MBCS_API.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import uuid # in python
import base64 # in python
import copy # in python
import yaml # MIT
import os # MIT

from enum import Enum # in python
from typing import Annotated
Expand All @@ -26,18 +26,16 @@
logging.FileHandler('example.log'),
])#filename='example.log')

# obtain config:
with open('consumer_cfg.yaml', 'r') as file:
consumer_cfg = yaml.safe_load(file)

# - control plane -
url_edc_consumer_control_plane_base = consumer_cfg['consumer-edc-control-plane']['endpoint']
header_control_plane = consumer_cfg['consumer-edc-control-plane']['header'] # this contains secrets, so please use -at least- a secretsmanager instead
url_edc_consumer_control_plane_base = os.getenv('ENDPOINT')
header_control_plane = {
'Content-Type': 'application/json',
'x-api-key': os.getenv('XAPIKEY')
}

# - "identities" -
edc_provider_bpn = consumer_cfg['trusted-providers']['Facotry_Operator_A']['BPN'] # "{{EDCTX-10-1-BPN}}"
url_edc_provider_control_plane_base = consumer_cfg['trusted-providers']['Facotry_Operator_A']['endpoint-control-plane']

edc_provider_bpn = os.getenv('BPN')
url_edc_provider_control_plane_base = os.getenv('ENDPOINTCONTROLPLANE')

class allowed_asset_types(str, Enum):
Submodel = "Submodel"
Expand All @@ -50,9 +48,6 @@ class allowed_asset_types(str, Enum):
async def root():
return "Machine Builder Condition Service [PoC TP2.04 & TP4.1]"

@app.get("/config") # REMOVE THIS BECAUSE YOU CAN ACCESS SECRETS!!!
async def get_condig():
return consumer_cfg


# obtain/view available offers
Expand Down

0 comments on commit 2256fb6

Please sign in to comment.