Skip to content

Commit

Permalink
LoadTest Container and GH Action
Browse files Browse the repository at this point in the history
  • Loading branch information
alvarof2 committed Oct 10, 2023
1 parent 647101d commit 8787c8a
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/odis-loadtest-container.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
name: Build ODIS loadtest image

on:
push:
paths:
- 'dockerfiles/phone-number-privacy/Dockerfile-loadtest'
- 'packages/phone-number-privacy/monitor/**'
branches:
- main
pull_request:
paths:
- 'dockerfiles/phone-number-privacy/Dockerfile-loadtest'
- 'packages/phone-number-privacy/monitor/**'
workflow_dispatch:

jobs:
odis-loadtest-build-dev:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
name: Build us-west1-docker.pkg.dev/devopsre/dev-images/odis-loadtest:${{ github.sha }}
if: |
github.ref != 'refs/heads/main'
with:
workload-id-provider: projects/1094498259535/locations/global/workloadIdentityPools/gh-social-connect/providers/github-by-repos
service-account: '[email protected]'
artifact-registry: us-west1-docker.pkg.dev/devopsre/dev-images/odis-loadtest
tag: ${{ github.sha }}
context: .
file: dockerfiles/phone-number-privacy/Dockerfile-loadtest
trivy: true

odis-loadtest-build:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
name: Build us-west1-docker.pkg.dev/devopsre/social-connect/odis-loadtest:${{ github.sha }}
if: |
github.ref == 'refs/heads/main'
with:
workload-id-provider: projects/1094498259535/locations/global/workloadIdentityPools/gh-social-connect-main/providers/github-by-repos
service-account: '[email protected]'
artifact-registry: us-west1-docker.pkg.dev/devopsre/social-connect/odis-loadtest
tag: ${{ github.sha }}
context: .
file: dockerfiles/phone-number-privacy/Dockerfile-loadtest
trivy: true
4 changes: 2 additions & 2 deletions .github/workflows/odis-signer-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
jobs:
odis-signer-build-dev:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
name: Build us-west1-docker.pkg.dev/devopsre/dev-images/monorepo:${{ github.sha }}
name: Build us-west1-docker.pkg.dev/devopsre/dev-images/odis-signer:${{ github.sha }}
if: |
github.ref != 'refs/heads/main'
with:
Expand All @@ -31,7 +31,7 @@

odis-signer-build:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
name: Build us-west1-docker.pkg.dev/devopsre/celo-monorepo/monorepo:${{ github.sha }}
name: Build us-west1-docker.pkg.dev/devopsre/social-connect/odis-signer:${{ github.sha }}
if: |
github.ref == 'refs/heads/main'
with:
Expand Down
42 changes: 42 additions & 0 deletions dockerfiles/phone-number-privacy/Dockerfile-loadtest
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
##### Gathering dependencies
FROM scratch AS packages

# Copy phone-number-privacy package and its dependency closure.
# Assemble all dependencies into the packages folder so the second stage can select whether to
# include all packages, or just the phone-number-privacy packages.
WORKDIR /celo-phone-number-privacy/
COPY packages/phone-number-privacy/monitor packages/phone-number-privacy/monitor
COPY packages/phone-number-privacy/common packages/phone-number-privacy/common
COPY packages/sdk/encrypted-backup packages/sdk/encrypted-backup
COPY packages/sdk/identity packages/sdk/identity

##### Main stage
FROM node:18
LABEL org.opencontainers.image.authors="[email protected]"

WORKDIR /celo-phone-number-privacy/

# Copy monorepo settings
COPY lerna.json package.json yarn.lock ./

# Makes build fail if it doesn't copy git, will be removed after build
COPY .git .git

# Setting ONLY_PUBLISHED_DEPENDENCIES to true or any non-empty string results in only the
# phone-number-privacy package being copied into the image, and therefore it will only build using
# published dependencies. Setting ONLY_PUBLISHED_DEPENDENCIES to "" will copy in all dependecies.
ARG ONLY_PUBLISHED_DEPENDENCIES=""
ARG PACKAGE_SELECTOR=${ONLY_PUBLISHED_DEPENDENCIES:+phone-number-privacy/monitor}
COPY --from=packages celo-phone-number-privacy/packages/${PACKAGE_SELECTOR} packages/${PACKAGE_SELECTOR}

# Install dependencies and build.
RUN yarn install --network-timeout 100000 --frozen-lockfile && yarn cache clean
RUN yarn build

RUN rm -r .git

# Setup and run the signer application.
ENV NODE_ENV production
WORKDIR /celo-phone-number-privacy/packages/phone-number-privacy/monitor
EXPOSE 8080
ENTRYPOINT ["yarn", "loadTest"]

0 comments on commit 8787c8a

Please sign in to comment.