mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
test environment variable
This commit is contained in:
parent
39d4e97de7
commit
f2a1a76735
4 changed files with 47 additions and 14 deletions
22
.github/workflows/_build_image.yml
vendored
22
.github/workflows/_build_image.yml
vendored
|
|
@ -13,6 +13,9 @@ on:
|
||||||
required: false
|
required: false
|
||||||
default: "."
|
default: "."
|
||||||
type: string
|
type: string
|
||||||
|
build_args:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
image_digest:
|
image_digest:
|
||||||
|
|
@ -64,8 +67,23 @@ jobs:
|
||||||
- name: Build & push image
|
- name: Build & push image
|
||||||
run: |
|
run: |
|
||||||
IMAGE_URI="${{ steps.repo.outputs.ecr_repo_url }}:${GITHUB_SHA}"
|
IMAGE_URI="${{ steps.repo.outputs.ecr_repo_url }}:${GITHUB_SHA}"
|
||||||
docker build -f ${{ inputs.dockerfile_path }} -t $IMAGE_URI ${{ inputs.build_context }}
|
|
||||||
docker push $IMAGE_URI
|
BUILD_ARGS=""
|
||||||
|
if [ -n "${{ inputs.build_args }}" ]; then
|
||||||
|
while read -r line; do
|
||||||
|
BUILD_ARGS="$BUILD_ARGS --build-arg $line"
|
||||||
|
done <<< "${{ inputs.build_args }}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
-f ${{ inputs.dockerfile_path }} \
|
||||||
|
$BUILD_ARGS \
|
||||||
|
-t $IMAGE_URI \
|
||||||
|
${{ inputs.build_context }}
|
||||||
|
|
||||||
|
docker push $IMAGE_UR
|
||||||
|
docker build -f ${{ inputs.dockerfile_path }} -t $IMAGE_URI ${{ inputs.build_context }}
|
||||||
|
docker push $IMAGE_URI
|
||||||
|
|
||||||
- name: Resolve image digest
|
- name: Resolve image digest
|
||||||
id: digest
|
id: digest
|
||||||
|
|
|
||||||
3
.github/workflows/deploy_terraform.yml
vendored
3
.github/workflows/deploy_terraform.yml
vendored
|
|
@ -140,6 +140,9 @@ jobs:
|
||||||
ecr_repo: condition-etl-${{ needs.determine_stage.outputs.stage }}
|
ecr_repo: condition-etl-${{ needs.determine_stage.outputs.stage }}
|
||||||
dockerfile_path: backend/condition/handler/Dockerfile
|
dockerfile_path: backend/condition/handler/Dockerfile
|
||||||
build_context: .
|
build_context: .
|
||||||
|
build_args: |
|
||||||
|
JUNTE=best3
|
||||||
|
|
||||||
secrets:
|
secrets:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.DEV_AWS_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.DEV_AWS_SECRET_ACCESS_KEY }}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,11 @@
|
||||||
FROM public.ecr.aws/lambda/python:3.11
|
FROM public.ecr.aws/lambda/python:3.11
|
||||||
# FROM python:3.11.10-bullseye # For local running
|
# For local running:
|
||||||
|
# FROM python:3.11.10-bullseye
|
||||||
|
|
||||||
|
# ARG EPC_AUTH_TOKEN
|
||||||
|
|
||||||
|
ARG JUNTE
|
||||||
|
ENV JUNTE=${JUNTE}
|
||||||
|
|
||||||
# Set working directory (Lambda task root)
|
# Set working directory (Lambda task root)
|
||||||
WORKDIR /var/task
|
WORKDIR /var/task
|
||||||
|
|
@ -24,10 +30,14 @@ COPY backend/app/config.py backend/app/config.py
|
||||||
|
|
||||||
COPY backend/__init__.py backend/__init__.py
|
COPY backend/__init__.py backend/__init__.py
|
||||||
COPY backend/app/__init__.py backend/app/__init__.py
|
COPY backend/app/__init__.py backend/app/__init__.py
|
||||||
COPY backend/app/db/__init__.py backend/app/db/__init__.py
|
COPY backend/app/db/__init__.py backend/app/db/__init__.py
|
||||||
|
|
||||||
|
|
||||||
|
# ENV EPC_AUTH_TOKEN=${EPC_AUTH_TOKEN}
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
# Lambda handler
|
# Lambda handler
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
CMD ["backend/condition/handler/handler.handler"]
|
CMD ["backend/condition/handler/handler.handler"]
|
||||||
# CMD ["python", "-m", "backend.condition.handler.handler"] # For local running
|
# For local running
|
||||||
|
# CMD ["python", "-m", "backend.condition.handler.handler"]
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,21 @@
|
||||||
import json
|
# import json
|
||||||
from typing import Mapping, Any
|
from typing import Mapping, Any
|
||||||
from io import BytesIO
|
import os
|
||||||
|
|
||||||
from backend.condition.condition_trigger_request import ConditionTriggerRequest
|
# from io import BytesIO
|
||||||
from backend.condition.lookups.uprn_lookup_s3 import UprnLookupS3
|
|
||||||
from backend.condition.processor import process_file
|
# from backend.condition.condition_trigger_request import ConditionTriggerRequest
|
||||||
from utils.logger import setup_logger
|
# from backend.condition.lookups.uprn_lookup_s3 import UprnLookupS3
|
||||||
from utils.s3 import read_io_from_s3
|
# from backend.condition.processor import process_file
|
||||||
|
# from utils.logger import setup_logger
|
||||||
|
# from utils.s3 import read_io_from_s3
|
||||||
|
|
||||||
|
|
||||||
logger = setup_logger()
|
# logger = setup_logger()
|
||||||
|
|
||||||
|
|
||||||
def handler(event: Mapping[str, Any], context: Any) -> None:
|
def handler(event: Mapping[str, Any], context: Any) -> None:
|
||||||
print("hello world")
|
print("hello world", os.getenv("JUNTE", "empty"))
|
||||||
# uprn_lookup = UprnLookupS3(
|
# uprn_lookup = UprnLookupS3(
|
||||||
# bucket="", key=""
|
# bucket="", key=""
|
||||||
# ) # TODO: replace with postgres implementation
|
# ) # TODO: replace with postgres implementation
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue