Skip to content

Instantly share code, notes, and snippets.

@stojce
Created February 29, 2020 13:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stojce/a2703e6a21f9447194c39bf762de8358 to your computer and use it in GitHub Desktop.
Save stojce/a2703e6a21f9447194c39bf762de8358 to your computer and use it in GitHub Desktop.
version: 0.2
env:
variables:
NODE_ENV: "${env}"
phases:
install:
runtime-versions:
nodejs: 12
commands:
- npm i
# - npm run lint
pre_build:
commands:
- npm i
- npm run test
build:
commands:
- npm run build
artifacts:
files:
- "**/*"
name: "web-dist-${env}"
base-directory: build
cache:
paths:
- /root/.npm/**/*
data "template_file" "buildspec" {
template = "${file("buildspec.yml")}"
vars = {
env = var.env
}
}
resource "aws_codebuild_project" "static_web_build" {
badge_enabled = false
build_timeout = 60
name = "static-web-build"
queued_timeout = 480
service_role = data.aws_iam_role.static_build_role.arn
tags = {
Environment = var.env
}
artifacts {
encryption_disabled = false
name = "static-web-build-${var.env}"
override_artifact_name = false
packaging = "NONE"
type = "CODEPIPELINE"
}
environment {
compute_type = "BUILD_GENERAL1_SMALL"
image = "aws/codebuild/amazonlinux2-x86_64-standard:2.0"
image_pull_credentials_type = "CODEBUILD"
privileged_mode = false
type = "LINUX_CONTAINER"
}
logs_config {
cloudwatch_logs {
status = "ENABLED"
}
s3_logs {
encryption_disabled = false
status = "DISABLED"
}
}
source {
buildspec = data.template_file.buildspec.rendered
git_clone_depth = 0
insecure_ssl = false
report_build_status = false
type = "CODEPIPELINE"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment