Skip to content
This repository has been archived by the owner on Mar 11, 2023. It is now read-only.

Commit

Permalink
Add Node.js example
Browse files Browse the repository at this point in the history
  • Loading branch information
benesch committed Jan 3, 2022
1 parent 1b76510 commit 6e35402
Show file tree
Hide file tree
Showing 7 changed files with 2,168 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/aws-nodejs/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
index.ts
node_modules
package.json
Pulumi.yaml
tsconfig.json
3 changes: 3 additions & 0 deletions examples/aws-nodejs/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ubuntu

RUN apt-get update && apt-get install -qy python-is-python3 python3
4 changes: 4 additions & 0 deletions examples/aws-nodejs/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: docker-buildkit-aws-typescript
description: Demonstrate Docker Buildkit usage with AWS and TypeScript.
runtime:
name: nodejs
16 changes: 16 additions & 0 deletions examples/aws-nodejs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as aws from "@pulumi/aws";
import * as dockerBuildkit from "@MaterializeInc/pulumi-docker-buildkit";

const repo = new aws.ecr.Repository("repo");

const registryInfo = repo.registryId.apply(async id => {
const credentials = await aws.ecr.getCredentials({ registryId: id });
const authToken = Buffer.from(credentials.authorizationToken, "base64");
const [username, password] = authToken.toString().split(":");
return { server: credentials.proxyEndpoint, username: username, password: password };
});

export const image = new dockerBuildkit.Image(
"image",
{ name: repo.repositoryUrl, registry: registryInfo },
).repoDigest;
Loading

0 comments on commit 6e35402

Please sign in to comment.