Skip to content
This repository has been archived by the owner on Jul 25, 2024. It is now read-only.

Commit

Permalink
build and use paketo image
Browse files Browse the repository at this point in the history
  • Loading branch information
gidsg committed May 21, 2024
1 parent 37829ce commit 71e0697
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 15 deletions.
37 changes: 29 additions & 8 deletions .github/workflows/pullpreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,24 @@ on:
types: [labeled, unlabeled, synchronize, closed, reopened]

jobs:
tag_version:
runs-on: ubuntu-latest
outputs:
version_to_tag: ${{ steps.tagging.outputs.tag_value }}
steps:
- id: tagging
run: |
echo "tag_value=$(echo '${{ github.ref }}' | sed -e 's,.*/\(.*\),\1,')" >> $GITHUB_OUTPUT
paketo_build:
permissions:
packages: write
needs: [ tag_version ]
uses: communitiesuk/funding-service-design-workflows/.github/workflows/package.yml@main
with:
assets_required: true
version_to_build: ${{ needs.tag_version.outputs.version_to_tag }}
owner: ${{ github.repository_owner }}
application: funding-service-design-post-award-submit
deploy:
permissions:
contents: read # to fetch code (actions/checkout)
Expand All @@ -16,11 +34,14 @@ jobs:
timeout-minutes: 30
environment: ${{ inputs.environment || 'dev' }}
steps:
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/GithubCopilotDeploy
role-session-name: POST_AWARD_DATA_STORE_PULLPREVIEW
aws-region: eu-west-2
- uses: actions/checkout@v2
- uses: pullpreview/action@v5.6.1
- name: Inject branch image into docker compose file
run: |
yq -i '.services.submit.image = "ghcr.io/communitiesuk/${{ github.event.repository.name }}:${{ github.ref_name == 'main' && 'latest' || needs.tag_version.outputs.version_to_tag }}"' docker-compose.yml
- name: Deploy preview environment
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_NUMBER }}:role/GithubCopilotDeploy
role-session-name: POST_AWARD_DATA_STORE_PULLPREVIEW
aws-region: eu-west-2
- uses: actions/checkout@v2
- uses: pullpreview/action@v5.6.1
10 changes: 3 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
services:
submit:
# https://github.com/communitiesuk/funding-service-design-post-award-data-store
build:
args:
REQUIREMENTS: requirements-dev.txt
command: bash -c "flask run -p 8080 -h 0.0.0.0"
volumes: [ '.:/app' ]
image: # Value injected by github actions
ports:
- 80:8080
environment:
Expand All @@ -31,8 +27,8 @@ services:
localstack:
image: localstack/localstack
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
- DEBUG=${DEBUG-}
- DOCKER_HOST=unix:///var/run/docker.sock
Expand Down

0 comments on commit 71e0697

Please sign in to comment.