Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .azure-pipelines/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Terraform pipeline to deploy infrastructure resourcse to azure cloud platform

trigger:
branches:
include:
- main # Trigger the pipeline when code is merged into main

pr:
branches:
include:
- main # Trigger the pipeline when a pull request targets the main branch

pool:
name: azure-vms-pool
demands:
- agent.name -equals azure-windows-vm # To run on a specific agent in a pool

variables:
subscriptionId: "51580edc-cdbf-4484-a549-ddd64f2264d6"

stages:
- stage: infra_deployment
jobs:
- job: terraform_build
pool:
name: "azure-vms-pool"
demands:
- agent.name -equals azure-windows-vm
steps:
- task: TerraformInstaller@1
displayName: intsall_terraform
inputs:
terraformVersion: "1.9.0"

- task: PowerShell@2
displayName: get_current_workspace
inputs:
targetType: "inline"
script: |
Write-Host "Pipeline workspace: $(System.DefaultWorkingDirectory)"
Write-Host "System Working Directory: $(System.DefaultWorkingDirectory)"
Write-Host "Current working directory content: $(dir)"

- task: TerraformTaskV4@4
displayName: run_tf_init
inputs:
workingDirectory: "$(System.DefaultWorkingDirectory)/terraform"
provider: "azurerm"
command: "custom"
customCommand: "init"
outputTo: "console"
environmentServiceNameAzureRM: "tf-azure-service-connection"
env:
ARM_SUBSCRIPTION_ID: $(subscriptionId)

- task: TerraformTaskV4@4
displayName: run_tf_plan
inputs:
workingDirectory: "$(System.DefaultWorkingDirectory)/terraform"
provider: "azurerm"
command: "custom"
customCommand: "plan"
commandOptions: "-out=tfplan"
outputTo: "console"
environmentServiceNameAzureRM: "tf-azure-service-connection"
env:
ARM_SUBSCRIPTION_ID: $(subscriptionId)

- task: TerraformTaskV4@4
displayName: run_tf_apply
condition: eq(variables['Build.SourceBranch'], 'refs/heads/main')
inputs:
workingDirectory: "$(System.DefaultWorkingDirectory)/terraform"
provider: "azurerm"
command: "custom"
customCommand: "apply"
commandOptions: "tfplan"
outputTo: "console"
environmentServiceNameAzureRM: "tf-azure-service-connection"
env:
ARM_SUBSCRIPTION_ID: $(subscriptionId)
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mycompany_app/__pycache__/

# Distribution / packaging
.Python
build/
# build/
develop-eggs/
dist/
downloads/
Expand Down Expand Up @@ -129,4 +129,4 @@ dmypy.json

# Pyre type checker
.pyre/
.vscode
# .vscode
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"EditorConfig.EditorConfig"
]
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true
}
14 changes: 0 additions & 14 deletions Dockerfile.tmp

This file was deleted.

13 changes: 5 additions & 8 deletions Dockerfile.tst
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ ENV PYTHONUNBUFFERED=1
RUN whoami
RUN groupadd --gid $GROUPID $GROUPNAME && useradd --uid $USERID --gid $GROUPID -m $USERNAME

# Install the tools required for the project
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-venv

# Copy requirements file and install all the required python packages
WORKDIR /app
COPY python/requirements.txt /app
Expand All @@ -35,7 +29,10 @@ RUN pip install --no-cache-dir -r requirements.txt

COPY python /app

# Change the user to newly created user
# Install curl
RUN apt-get update && apt-get install -y curl

# Change the user to newly created user and run the processes as this user
USER $USERNAME
RUN whoami

Expand All @@ -47,4 +44,4 @@ WORKDIR /app

# Run the main application file on container startup
ENTRYPOINT ["gunicorn"]
CMD ["--bind", "0.0.0.0:5001", "--workers", "1", "--threads", "8", "main:app"]
CMD ["--bind", "0.0.0.0:5001", "--workers", "1", "--threads", "8", "run:app"]
File renamed without changes.
Empty file added build/gitlab-ci.yaml
Empty file.