Skip to content

Commit

Permalink
[DOP-4334]: Use cdk again
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Feb 24, 2024
1 parent 83610b0 commit e7967ab
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/update-feature-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,18 +107,18 @@ 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
outputs: type=tar,dest=cdk-infra/image.tar.gz
# - 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
# outputs: type=tar,dest=cdk-infra/image.tar.gz
- name: Update Worker Stack
if: steps.filter.outputs.worker == 'true'
run: |
Expand Down
11 changes: 10 additions & 1 deletion cdk-infra/lib/constructs/worker/worker-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,15 @@ export class WorkerConstruct extends Construct {

executionRole.addToPolicy(executionRoleSsmPolicy);

const containerProps: AssetImageProps = {
buildArgs: {
NPM_BASE_64_AUTH: dockerEnvironment.NPM_BASE_64_AUTH,
NPM_EMAIL: dockerEnvironment.NPM_EMAIL,
},
cacheTo: { type: 'gha', params: { mode: 'max' } },
cacheFrom: [{ type: 'gha' }],
};

const taskDefLogGroup = new LogGroup(this, 'workerLogGroup');
const taskDefinition = new FargateTaskDefinition(this, 'workerTaskDefinition', {
cpu: 4096,
Expand All @@ -86,7 +95,7 @@ export class WorkerConstruct extends Construct {
taskRole.addToPolicy(updateTaskProtectionPolicy);

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

0 comments on commit e7967ab

Please sign in to comment.