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

Commit 6e35402

Browse files
committed
Add Node.js example
1 parent 1b76510 commit 6e35402

File tree

7 files changed

+2168
-0
lines changed

7 files changed

+2168
-0
lines changed

examples/aws-nodejs/.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
index.ts
2+
node_modules
3+
package.json
4+
Pulumi.yaml
5+
tsconfig.json

examples/aws-nodejs/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM ubuntu
2+
3+
RUN apt-get update && apt-get install -qy python-is-python3 python3

examples/aws-nodejs/Pulumi.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
name: docker-buildkit-aws-typescript
2+
description: Demonstrate Docker Buildkit usage with AWS and TypeScript.
3+
runtime:
4+
name: nodejs

examples/aws-nodejs/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import * as aws from "@pulumi/aws";
2+
import * as dockerBuildkit from "@MaterializeInc/pulumi-docker-buildkit";
3+
4+
const repo = new aws.ecr.Repository("repo");
5+
6+
const registryInfo = repo.registryId.apply(async id => {
7+
const credentials = await aws.ecr.getCredentials({ registryId: id });
8+
const authToken = Buffer.from(credentials.authorizationToken, "base64");
9+
const [username, password] = authToken.toString().split(":");
10+
return { server: credentials.proxyEndpoint, username: username, password: password };
11+
});
12+
13+
export const image = new dockerBuildkit.Image(
14+
"image",
15+
{ name: repo.repositoryUrl, registry: registryInfo },
16+
).repoDigest;

0 commit comments

Comments
 (0)