Used in AWS CodeBuild to build Node.js apps and connect to PostgreSQL databases.
1.9K
A Docker image designed to be used in AWS CodeBuild to build Node.js apps and connect to PostgreSQL databases.
The following ordered setup instructions use Terraform to configure AWS.
Create a CodeBuild; note the image attribute of environment:
resource "aws_codebuild_project" "api" {
name = "api"
description = "Builds an API and recreates a test database."
build_timeout = 20
service_role = "${aws_iam_role.codebuild.arn}"
artifacts {
type = "S3"
location = "${aws_s3_bucket.bucket.id}"
packaging = "ZIP"
encryption_disabled = true
}
cache {
type = "LOCAL"
modes = [
"LOCAL_DOCKER_LAYER_CACHE",
"LOCAL_SOURCE_CACHE"
]
}
environment {
compute_type = "BUILD_GENERAL1_MEDIUM"
image = "whatishedoing/docker-aws-node-postgres"
privileged_mode = false
type = "LINUX_CONTAINER"
# Set any Postgres environment variables...
# https://www.postgresql.org/docs/current/libpq-envars.html
environment_variable {
name = "PG_HOST"
value = "${aws_db_instance.db.address}"
}
environment_variable {
name = "S3_ARTIFACTS_BUCKET"
value = "${aws_s3_bucket.bucket.id}"
}
}
source {
buildspec = "buildspec.yml"
git_clone_depth = 1
location = "${aws_codecommit_repository.api.clone_url_http}"
type = "CODECOMMIT"
}
logs_config {
cloudwatch_logs {
group_name = "${aws_cloudwatch_log_group.codebuild.name}"
stream_name = "${aws_cloudwatch_log_stream.codebuild.name}"
}
}
tags = {
Environment = "tools"
Terraform = true
}
}
In the root of the source control repository, add a buildspec.yml:
version: 0.2
phases:
install:
commands:
- yarn install --frozen-lockfile
build:
commands:
- yarn start
Content type
Image
Digest
Size
335.1 MB
Last updated
almost 7 years ago
docker pull whatishedoing/docker-aws-node-postgres