Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import * as awsx from "@pulumi/awsx";
import * as k8s from "@pulumi/kubernetes";
import * as kx from "@pulumi/kubernetesx";
import { config } from "./config";
// Create a repository.
const repo = new awsx.ecr.Repository("my-repo");
// Build a Docker image from a local Dockerfile context in the
// './node-app' directory, and push it to the registry.
const customImage = "node-app";
const appImage = repo.buildAndPushImage(`./${customImage}`);
// Create a k8s provider.
const provider = new k8s.Provider("provider", {
kubeconfig: config.kubeconfig,
namespace: config.appsNamespaceName,
});
// Create a Deployment of the built container.
const appLabels = { app: customImage };
const appDeployment = new k8s.apps.v1.Deployment("app", {
spec: {
const webappRepoName = `gauzy/webapp-${environment.toLowerCase()}`;
const repositoryWebapp = new aws.ecr.Repository(webappRepoName, {
name: webappRepoName
});
let apiImage;
// Build and publish a Docker image to a private ECR registry for API.
if (environment !== Environment.Prod) {
apiImage = awsx.ecs.Image.fromDockerBuild(repositoryApi, {
context: config.dockerContextPath,
dockerfile: config.dockerAPIFile
});
} else {
apiImage = awsx.ecr.buildAndPushImage(
apiRepoName,
{
context: config.dockerContextPath,
dockerfile: config.dockerAPIFile
},
{ repository: repositoryApi }
);
}
let webappImage;
// Build and publish a Docker image to a private ECR registry for Web App.
if (environment !== Environment.Prod) {
webappImage = awsx.ecs.Image.fromDockerBuild(repositoryWebapp, {
context: config.dockerContextPath,
dockerfile: config.dockerWebappFile