diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3c4fa33 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# To enable ssh & remote debugging on app service change the base image to the one below +# FROM mcr.microsoft.com/azure-functions/python:4-python3.11-appservice +FROM mcr.microsoft.com/azure-functions/python:4-python3.11 + +ENV AzureWebJobsScriptRoot=/home/site/wwwroot \ + AzureFunctionsJobHost__Logging__Console__IsEnabled=true \ + AzureWebJobsFeatureFlags=EnableWorkerIndexing \ + AzureWebJobsStorage=UseDevelopmentStorage=true \ + APPLICATION_ID=${APPLICATION_ID} \ + DATABASE_HOST=${DATABASE_HOST} \ + DATABASE_USER=${DATABASE_USER} \ + DATABASE_PASSWORD=${DATABASE_PASSWORD} \ + DATABASE_NAME=${DATABASE_NAME} \ + FUNCTIONS_WORKER_RUNTIME=python \ + NOTIFY_API_KEY=${NOTIFY_API_KEY} \ + NOTIFY_API_URL=${NOTIFY_API_URL} + +COPY --from=root_dir Pipfile / +COPY --from=root_dir Pipfile.lock / +RUN pip install pipenv +RUN pipenv install --system + +COPY . /home/site/wwwroot +COPY ./database/schema.sql /home/site/wwwroot/database/schema.sql diff --git a/compose.yml b/compose.yml index a81b62f..0766e8a 100644 --- a/compose.yml +++ b/compose.yml @@ -1,38 +1,6 @@ name: communication-management services: - # External Dependencies - azurite: - container_name: azurite - image: mcr.microsoft.com/azure-storage/azurite - command: "azurite --loose --blobHost 0.0.0.0 --blobPort 10000 --queueHost 0.0.0.0 --queuePort 10001" - ports: - - 10000:10000 - - 10001:10001 - - 10002:10002 - profiles: - - test-end-to-end - - test-integration - - dev - networks: - - frontend - - azurite-setup: - container_name: azurite-setup - build: - context: ./ - dockerfile: ./dependencies/azurite/Dockerfile - network_mode: host - depends_on: - - azurite - environment: - - AZURITE_CONNECTION_STRING=${AZURITE_CONNECTION_STRING} - - BLOB_CONTAINER_NAME=${BLOB_CONTAINER_NAME} - profiles: - - test-end-to-end - - test-integration - - dev - db: image: postgres healthcheck: @@ -52,130 +20,31 @@ services: volumes: - ./pgdata:/var/lib/postgresql/pgdata profiles: - - test-end-to-end - - test-integration - dev - end-to-end-tests: - container_name: end-to-end-tests + communication-management: + container_name: communication-management network_mode: host build: - context: ./tests/end_to_end/ - additional_contexts: - root_dir: . - shared_dir: ./src/shared/ + context: . dockerfile: Dockerfile - environment: - - AZURITE_CONNECTION_STRING=${AZURITE_CONNECTION_STRING} - - BLOB_CONTAINER_NAME=${BLOB_CONTAINER_NAME} - - DATABASE_HOST=${DATABASE_HOST} - - DATABASE_NAME=${DATABASE_NAME} - - DATABASE_PASSWORD=${DATABASE_PASSWORD} - - DATABASE_SSLMODE=${DATABASE_SSLMODE} - - DATABASE_USER=${DATABASE_USER} - profiles: - - test-end-to-end depends_on: - azurite-setup: - condition: service_completed_successfully - azurite: - condition: service_started db: condition: service_healthy - notify: - condition: service_started - process-pilot-data: - condition: service_started - volumes: - - ./log/functions/notify:/tests/end_to_end/log/functions/notify - - ./log/functions/process-pilot-data:/tests/end_to_end/log/functions/process-pilot-data - - # Functions - message-status: - container_name: message-status - network_mode: host - build: - context: ./src/functions/message_status/ - additional_contexts: - root_dir: . - dockerfile: Dockerfile environment: - AzureWebJobsStorage=UseDevelopmentStorage=true - - ASPNETCORE_URLS=http://*:7073 - APPLICATION_ID=${APPLICATION_ID} - - NOTIFY_API_KEY=${NOTIFY_API_KEY} - - DATABASE_HOST=${DATABASE_HOST} - - DATABASE_NAME=${DATABASE_NAME} - - DATABASE_PASSWORD=${DATABASE_PASSWORD} - - DATABASE_SSLMODE=${DATABASE_SSLMODE} - - DATABASE_USER=${DATABASE_USER} - - notify: - container_name: notify - network_mode: host - build: - context: ./src/functions/notify/ - additional_contexts: - root_dir: . - dockerfile: Dockerfile - environment: - - AzureWebJobsStorage=UseDevelopmentStorage=true - ASPNETCORE_URLS=http://*:7072 - DATABASE_HOST=${DATABASE_HOST} - DATABASE_NAME=${DATABASE_NAME} - DATABASE_PASSWORD=${DATABASE_PASSWORD} - DATABASE_SSLMODE=${DATABASE_SSLMODE} - DATABASE_USER=${DATABASE_USER} + - NOTIFY_API_KEY=${NOTIFY_API_KEY} - NOTIFY_API_URL=${NOTIFY_API_URL} - OAUTH2_API_KEY=${OAUTH2_API_KEY} - OAUTH2_API_KID=${OAUTH2_API_KID} - OAUTH2_TOKEN_URL=${OAUTH2_TOKEN_URL} - PRIVATE_KEY=${PRIVATE_KEY} volumes: - - ./log/functions/notify:/tmp/Functions/Host - - process-pilot-data: - container_name: process-pilot-data - network_mode: host - build: - context: ./src/functions/process_pilot_data/ - additional_contexts: - root_dir: . - dockerfile: Dockerfile - environment: - - AzureWebJobsStorage=UseDevelopmentStorage=true - - ASPNETCORE_URLS=http://*:7071 - - FUNCTIONS_WORKER_RUNTIME=python - - BLOB_CONTAINER_NAME=${BLOB_CONTAINER_NAME} - - NOTIFY_FUNCTION_URL=${NOTIFY_FUNCTION_URL} - volumes: - - ./log/functions/process-pilot-data:/tmp/Functions/Host - - integration-tests: - container_name: integration-tests - network_mode: host - build: - context: ./tests/integration/ - additional_contexts: - root_dir: . - shared_dir: ./src/shared/ - dockerfile: Dockerfile - environment: - - DATABASE_HOST=${DATABASE_HOST} - - DATABASE_NAME=${DATABASE_NAME} - - DATABASE_PASSWORD=${DATABASE_PASSWORD} - - DATABASE_SSLMODE=${DATABASE_SSLMODE} - - DATABASE_USER=${DATABASE_USER} - - NOTIFY_API_URL=${NOTIFY_API_URL} - profiles: - - test-integration - depends_on: - db: - condition: service_healthy - -networks: - frontend: - # Specify driver options - driver: bridge - driver_opts: - com.docker.network.bridge.host_binding_ipv4: "127.0.0.1" + - ./log/function/communication-management:/tmp/Functions/Host