Skip to content

Commit 1ff11d7

Browse files
rodolfoIOETRodolfo
andauthored
Tta 139 deploy production environment for v 2 (#924)
* TTA-139 enabling prod * TTA-139 update pipeline prod * updating image for stage and prod * split docker files * TTA-139 fix docker image for prod * TTA-139 locking blob terraform * TTA-139 destroy app service of prod * TTA-139 destroy app service plan of prod * using tag * TTA-139 use branch for terraform modules * TTA-139 skipping docker and test * TTA-139 update tag version for ui module terrraform * TTA-139 making docker build and running tests Co-authored-by: Rodolfo <rodolfo@no_email.com>
1 parent 95cd393 commit 1ff11d7

File tree

6 files changed

+39
-33
lines changed

6 files changed

+39
-33
lines changed

.github/workflows/time-tracker-ui-cd-prod.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
ARM_CLIENT_SECRET: ${{secrets.TF_ARM_CLIENT_SECRET}}
1616
ARM_SUBSCRIPTION_ID: ${{secrets.TF_ARM_SUBSCRIPTION_ID}}
1717
ARM_TENANT_ID: ${{secrets.TF_ARM_TENANT_ID}}
18-
18+
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v3
@@ -30,8 +30,16 @@ jobs:
3030
with:
3131
creds: ${{ secrets.AZURE_CREDENTIALS }}
3232

33+
- name: Unlock PROD secrets
34+
uses: sliteteam/[email protected]
35+
env:
36+
GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY_PROD }}
37+
3338
- name: Build the docker image
34-
run: make build_prod
39+
run: |-
40+
docker build \
41+
--target production -t timetracker_ui -f Dockerfile_prod \
42+
.
3543
3644
- name: Publish docker image to prod azure container registry
3745
run: |

.github/workflows/time-tracker-ui-cd-stage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
- name: Build the docker image
3939
run: |-
4040
docker build \
41-
--target production -t timetracker_ui \
41+
--target production -t timetracker_ui -f Dockerfile_stage \
4242
.
4343
4444
- name: Publish docker image to stage azure container registry
@@ -61,4 +61,4 @@ jobs:
6161

6262
- name: Terraform Apply
6363
working-directory: ${{ env.WORKING_DIR }}
64-
run: terraform apply -lock=false -var-file="${{ env.TF_WORKSPACE }}.tfvars" -var "image_tag=$RELEASE_VERSION" -auto-approve
64+
run: terraform apply -var-file="${{ env.TF_WORKSPACE }}.tfvars" -var "image_tag=$RELEASE_VERSION" -auto-approve

Dockerfile

Lines changed: 0 additions & 28 deletions
This file was deleted.

Dockerfile_prod

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node:14-alpine AS building
2+
WORKDIR /app
3+
COPY . /app
4+
RUN npm cache clean --force && npm install
5+
EXPOSE 4200 9876
6+
RUN source .prod.env && npm run build
7+
8+
9+
FROM nginx:1.21 AS production
10+
COPY nginx.conf /etc/nginx/conf.d/default.conf
11+
COPY --from=building /app/dist/time-tracker /usr/share/nginx/html
12+
EXPOSE 80
13+

Dockerfile_stage

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM node:14-alpine AS building
2+
WORKDIR /app
3+
COPY . /app
4+
RUN npm cache clean --force && npm install
5+
EXPOSE 4200 9876
6+
RUN source .stage.env && npm run build
7+
8+
9+
FROM nginx:1.21 AS production
10+
COPY nginx.conf /etc/nginx/conf.d/default.conf
11+
COPY --from=building /app/dist/time-tracker /usr/share/nginx/html
12+
EXPOSE 80
13+

infrastructure/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ locals {
4343

4444
module "ui" {
4545
#source = "../../infra-terraform-modules/azure-app-service"
46-
source = "[email protected]:ioet/infra-terraform-modules.git//azure-app-service?ref=tags/v0.0.13"
46+
source = "[email protected]:ioet/infra-terraform-modules.git//azure-app-service?ref=tags/v0.0.20"
4747
app_service_name = "${local.service_name}-ui"
4848
create_app_service_plan = local.create_app_service_plan
4949
docker_image_name = "${local.image_name}:${var.image_tag}"

0 commit comments

Comments
 (0)