From e19fe0204571bb1416ffebc4a9142acc31f9f3c9 Mon Sep 17 00:00:00 2001 From: diana esteves Date: Mon, 15 Jul 2024 16:03:56 +0000 Subject: [PATCH] added example --- aws-ts-containers-dockerbuild/Pulumi.yaml | 10 ++ aws-ts-containers-dockerbuild/README.md | 46 +++++++++ aws-ts-containers-dockerbuild/app/Dockerfile | 2 + .../app/content/favicon.png | Bin 0 -> 13731 bytes .../app/content/index.html | 7 ++ aws-ts-containers-dockerbuild/index.ts | 91 ++++++++++++++++++ aws-ts-containers-dockerbuild/package.json | 13 +++ aws-ts-containers-dockerbuildcloud/README.md | 4 +- 8 files changed, 171 insertions(+), 2 deletions(-) create mode 100644 aws-ts-containers-dockerbuild/Pulumi.yaml create mode 100644 aws-ts-containers-dockerbuild/README.md create mode 100644 aws-ts-containers-dockerbuild/app/Dockerfile create mode 100644 aws-ts-containers-dockerbuild/app/content/favicon.png create mode 100644 aws-ts-containers-dockerbuild/app/content/index.html create mode 100644 aws-ts-containers-dockerbuild/index.ts create mode 100644 aws-ts-containers-dockerbuild/package.json diff --git a/aws-ts-containers-dockerbuild/Pulumi.yaml b/aws-ts-containers-dockerbuild/Pulumi.yaml new file mode 100644 index 000000000..d2b3644ea --- /dev/null +++ b/aws-ts-containers-dockerbuild/Pulumi.yaml @@ -0,0 +1,10 @@ +name: ${PROJECT} +description: ${DESCRIPTION} +runtime: nodejs + +template: + description: An example that builds a Docker image and deploys a container to AWS Fargate. + config: + aws:region: + description: The AWS region to deploy into + default: us-west-2 diff --git a/aws-ts-containers-dockerbuild/README.md b/aws-ts-containers-dockerbuild/README.md new file mode 100644 index 000000000..b9adbc37f --- /dev/null +++ b/aws-ts-containers-dockerbuild/README.md @@ -0,0 +1,46 @@ +# Deploys a container with a Docker Build image on AWS Fargate + +Deploys a AWS Fargate service. The service uses a Docker image that is build with the new Docker Build provider. The image is pushed to AWS ECR. + +Last revision: July 2024. + +## ๐Ÿ“‹ Pre-requisites + +- [Pulumi CLI](https://www.pulumi.com/docs/get-started/install/) +- *Recommended* [Pulumi Cloud account](https://app.pulumi.com/signup) +- [npm](https://www.npmjs.com/get-npm) +- AWS account and credentials configured + +## ๐Ÿ‘ฉโ€๐Ÿซ Get started + +This Pulumi example is written as a template. It is meant to be copied via `pulumi new` as follows: + +```bash +pulumi new https://github.com/pulumi/examples/tree/master/aws-ts-containers-dockerbuild +npm install +``` + +Once copied to your machine, feel free to edit as needed. + +## ๐ŸŽฌ How to run + +To deploy your infrastructure, run: + +```bash +$ pulumi up +# select 'yes' to confirm the expected changes +# wait a bit for everything to get deployed +# ... +# confirm your service is up and running +$ curl $(pulumi stack output url) +# ๐ŸŽ‰ Ta-Da! +``` + +## ๐Ÿงน Clean up + +To clean up your infrastructure, run: + +```bash +$ pulumi destroy +# select 'yes' to confirm the expected changes +``` diff --git a/aws-ts-containers-dockerbuild/app/Dockerfile b/aws-ts-containers-dockerbuild/app/Dockerfile new file mode 100644 index 000000000..4f9d60fb7 --- /dev/null +++ b/aws-ts-containers-dockerbuild/app/Dockerfile @@ -0,0 +1,2 @@ +FROM nginx +COPY content /usr/share/nginx/html diff --git a/aws-ts-containers-dockerbuild/app/content/favicon.png b/aws-ts-containers-dockerbuild/app/content/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..ad4baeb6fd3df3a99e06099e7a94b2715eaad419 GIT binary patch literal 13731 zcmW+-1yoay8{Np!-8n)^k?!t>(J0a&A>G~GA%b*wBO%?LN(o2{k^`jc|9=0&89Up~ zVDG*A-S6J}eT&vmlgC0QM+bpGSc(cVn!vpaa0`N<0KbX7bYc?tHB&wUDsx0ajIu!_kMvn6<@EVB9MqA%a+R@(L(!mXQ z2m(pFSem+7TF`phxLMQ6E2?T(uv?;nK(ru58A)xgUnl;aeufL*PFrsTKU(q3^IZM* z{r1(~qCTFJRE4*IAOwm_i^jhu&kh}<|3U(RLc^7%X#aUM*pwn^#r3sK$hKHcG%l2o zUDf_|{S^=xXO+}pF%h0|^+1MUH=XIa*s8Z~SECAlQ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{Ytn>_PLw3sS^r1jNLo${@iR(ccyU(5ibu`9BkIrEusy2ofwEN)shB0iy`}$o*rir=yX2*8{TSM zh0%CQrl|NuazCczA1dBsP4zS1k-w0nJJakbZuiQ`is_5-c5>ufjZCgoa3&~LE7K3chOkc`h$tk1h8pC6y`>sx z({SR=&*qI{(|BsO0rn=Z;4x2j`1z5Wdw3Fwfh25FC*!TMsU{{keqO`Bvicr{aP)+* tIlSoCln7pTX_%u;^Qlu##o5&h7|#m*&z7PN`+wh+Qj}Gbsg*Jb`5)Yh=^ literal 0 HcmV?d00001 diff --git a/aws-ts-containers-dockerbuild/app/content/index.html b/aws-ts-containers-dockerbuild/app/content/index.html new file mode 100644 index 000000000..4081eb79c --- /dev/null +++ b/aws-ts-containers-dockerbuild/app/content/index.html @@ -0,0 +1,7 @@ + + + Hello, Pulumi! + +

Hello, containers!

+

Made with โค๏ธ with Pulumi and deployed to Fargate

+ \ No newline at end of file diff --git a/aws-ts-containers-dockerbuild/index.ts b/aws-ts-containers-dockerbuild/index.ts new file mode 100644 index 000000000..3c6278a3d --- /dev/null +++ b/aws-ts-containers-dockerbuild/index.ts @@ -0,0 +1,91 @@ +// Copyright 2024, Pulumi Corporation. All rights reserved. + +// Import required libraries +import * as aws from "@pulumi/aws"; // Required for ECS +import * as awsx from "@pulumi/awsx"; +import * as dockerBuild from "@pulumi/docker-build"; +import * as pulumi from "@pulumi/pulumi"; // Required for Config and interpolation + +// Read the current stack configuration, see Pulumi..yaml file +// Configuration values can be set with the pulumi config set command +// OR by editing the Pulumi..yaml file. +// OR during the pulumi new wizard. +const config = new pulumi.Config(); + +// An ECS cluster to deploy into. +const cluster = new aws.ecs.Cluster("cluster", {}); + +// An ALB to serve the container endpoint to the internet. +const loadbalancer = new awsx.lb.ApplicationLoadBalancer("loadbalancer", {}); + +// An ECR repository to store our application's container image. +const ecr = new awsx.ecr.Repository("repo", { + forceDelete: true, +}); + +// Grab auth credentials for ECR. +const auth = aws.ecr.getAuthorizationTokenOutput({ + registryId: ecr.repository.registryId, +}); + +// Build and publish our application's container image from ./app to the ECR repository. +const image = new dockerBuild.Image("image", { + + // Use the pushed image as a cache source. + cacheFrom: [{ + registry: { + ref: pulumi.interpolate`${ecr.repository.repositoryUrl}:cache`, + }, + }], + cacheTo: [{ + registry: { + imageManifest: true, + ociMediaTypes: true, + ref: pulumi.interpolate`${ecr.repository.repositoryUrl}:cache`, + }, + }], + + // Build multi-platforms + platforms: [ + dockerBuild.Platform.Linux_amd64, + // add more as needed + ], + push: true, + // Provide our ECR credentials. + registries: [{ + address: ecr.repository.repositoryUrl, + password: auth.password, + username: auth.userName, + }], + // + // Other parameters + // + // Tag our image with our ECR repository's address. + tags: [pulumi.interpolate`${ecr.repository.repositoryUrl}:latest`], + // The Dockerfile resides in the app directory for this example. + context: { + location: "app", + }, +}); + +// Deploy an ECS Service on Fargate to host the application container. +const service = new awsx.ecs.FargateService("service", { + cluster: cluster.arn, + assignPublicIp: true, + taskDefinitionArgs: { + container: { + name: "service-container", + image: image.ref, + cpu: 128, + memory: 512, + essential: true, + portMappings: [{ + containerPort: 80, + targetGroup: loadbalancer.defaultTargetGroup, + }], + }, + }, +}); + +// The URL at which the container's HTTP endpoint will be available. +export const url = pulumi.interpolate`http://${loadbalancer.loadBalancer.dnsName}`; diff --git a/aws-ts-containers-dockerbuild/package.json b/aws-ts-containers-dockerbuild/package.json new file mode 100644 index 000000000..6080e6724 --- /dev/null +++ b/aws-ts-containers-dockerbuild/package.json @@ -0,0 +1,13 @@ +{ + "name": "aws-ts-containers-dockerbuildcloud", + "main": "index.ts", + "dependencies": { + "@pulumi/aws": "^6.44.0", + "@pulumi/awsx": "^2.13.0", + "@pulumi/docker-build": "^0.0.3", + "@pulumi/pulumi": "^3.124.0" + }, + "devDependencies": { + "@types/node": "^20.14.10" + } +} diff --git a/aws-ts-containers-dockerbuildcloud/README.md b/aws-ts-containers-dockerbuildcloud/README.md index 82478dc5f..a8eac4c5f 100644 --- a/aws-ts-containers-dockerbuildcloud/README.md +++ b/aws-ts-containers-dockerbuildcloud/README.md @@ -19,8 +19,8 @@ Last revision: May 2024. This Pulumi example is written as a template. It is meant to be copied via `pulumi new` as follows: ```bash -$ pulumi new https://github.com/pulumi/examples/tree/master/aws-ts-containers-dbc -$ npm install +pulumi new https://github.com/pulumi/examples/tree/master/aws-ts-containers-dockerbuildcloud +npm install ``` Once copied to your machine, feel free to edit as needed.