Skip to content

Commit

Permalink
[DOP-4334]: Add caching to docker builds hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Feb 22, 2024
1 parent 47e088f commit 2d34eee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/update-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ jobs:
needs: prep-build
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.12.0
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand Down Expand Up @@ -83,6 +79,8 @@ jobs:
needs: prep-build
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
Expand All @@ -109,6 +107,15 @@ jobs:
- 'cdk-infra/lib/constructs/worker/**'
- 'Dockerfile'
- 'modules/**'
- uses: docker/build-push-action@v5
if: steps.filter.outputs.worker == 'true'
name: build Docker image
with:
context: .
tags: autobuilder/enhanced:latest
build-args: NPM_EMAIL=${{ secrets.NPM_EMAIL }},NPM_BASE_64_AUTH=${{ secrets.NPM_BASE64_AUTH }}
cache-from: type=gha,ref=autobuilder/enhanced:latest
cache-to: type=gha,mode=max
- name: Update Worker Stack
if: steps.filter.outputs.worker == 'true'
run: |
Expand Down
2 changes: 1 addition & 1 deletion cdk-infra/lib/constructs/worker/worker-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class WorkerConstruct extends Construct {
taskRole.addToPolicy(updateTaskProtectionPolicy);

taskDefinition.addContainer('workerImage', {
image: ContainerImage.fromAsset(path.join(__dirname, '../../../../'), containerProps),
image: ContainerImage.fromTarball(`${process.cwd()}/image.tar.gz`),
environment: dockerEnvironment,
command: ['node', '--enable-source-maps', 'enhanced/enhancedApp.js'],
logging: LogDrivers.awsLogs({
Expand Down

0 comments on commit 2d34eee

Please sign in to comment.