Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit 6f9ad0a

Browse files
Initial implementation
This basically extracts the build container image from our `pulumi-hcp` provider into its own repository so it can be more clearly used in different providers. Signed-off-by: Christopher Maier <[email protected]>
1 parent 99ea69c commit 6f9ad0a

File tree

9 files changed

+524
-0
lines changed

9 files changed

+524
-0
lines changed

.buildkite/pipeline.verify.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
env:
3+
PANTS_CONFIG_FILES: "['pants.toml', 'pants.ci.toml']"
4+
5+
steps:
6+
- label: ":lint-roller::docker: Lint Dockerfile"
7+
command:
8+
- make lint-docker
9+
10+
- label: ":docker: Build Image"
11+
command:
12+
- make image

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.pants.d
2+
.pids

BUILD

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
docker_image(
2+
name="build-environment",
3+
)

Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# syntax=docker/dockerfile:1.3-labs
2+
3+
ARG PULUMI_VERSION
4+
5+
# This gets us the Pulumi CLI, as well as current language runtimes
6+
# for Go, Node/TypeScript, Python, and .NET.
7+
FROM pulumi/pulumi:${PULUMI_VERSION}
8+
9+
ARG PULUMICTL_VERSION
10+
ARG GOLANGCI_LINT_VERSION
11+
ARG GORELEASER_VERSION
12+
13+
SHELL ["/bin/bash", "-o", "errexit", "-o", "nounset", "-o", "pipefail", "-c"]
14+
15+
RUN <<EOF
16+
curl \
17+
--proto "=https" \
18+
--tlsv1.2 \
19+
--location \
20+
--fail \
21+
--verbose \
22+
--output "pulumictl.tar.gz" \
23+
"https://github.com/pulumi/pulumictl/releases/download/v${PULUMICTL_VERSION}/pulumictl-v${PULUMICTL_VERSION}-linux-amd64.tar.gz"
24+
mkdir pulumictl_extraction
25+
tar --extract --gunzip --verbose --directory pulumictl_extraction --file pulumictl.tar.gz
26+
mv pulumictl_extraction/pulumictl /usr/local/bin/pulumictl
27+
chmod a+x /usr/local/bin/pulumictl
28+
rm -Rf pulumictl_extraction
29+
rm pulumictl.tar.gz
30+
31+
# Install golangci-lint
32+
curl --proto "=https" \
33+
--tlsv1.2 \
34+
--silent \
35+
--show-error \
36+
--fail \
37+
--location \
38+
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh \
39+
| sh -s -- -b "$(go env GOPATH)/bin" "v${GOLANGCI_LINT_VERSION}"
40+
41+
# Install goreleaser
42+
go install "github.com/goreleaser/goreleaser@v${GORELEASER_VERSION}"
43+
44+
EOF
45+
46+
# The default entrypoint of our base image is `pulumi`; we don't
47+
# want that.
48+
ENTRYPOINT []
49+
CMD ["bash"]

Makefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.DEFAULT_GOAL = all
2+
3+
.PHONY: all
4+
all: lint-docker
5+
all: image
6+
all: # Run all tasks
7+
8+
.PHONY: lint-docker
9+
lint-docker: ## Lint Dockerfiles
10+
./pants filter --target-type=docker_image :: | xargs ./pants lint
11+
12+
.PHONY: image
13+
image: ## Build the container image
14+
docker buildx bake
15+
16+
.PHONY: image-push
17+
image-push: ## Build *and* push the container image to a repository
18+
docker buildx bake --push

docker-bake.hcl

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
variable "PULUMI_VERSION" {
2+
default = "3.30.0"
3+
}
4+
5+
variable "PULUMICTL_VERSION" {
6+
default = "0.0.31"
7+
}
8+
9+
variable "GOLANGCI_LINT_VERSION" {
10+
# Note: No leading "v"
11+
default = "1.45.2"
12+
}
13+
14+
variable "GORELEASER_VERSION" {
15+
# Note: No leading "v"
16+
default = "1.6.3"
17+
}
18+
19+
group "default" {
20+
targets = [
21+
"pulumi-provider-build-environment"
22+
]
23+
}
24+
25+
target "pulumi-provider-build-environment" {
26+
context = "."
27+
dockerfile = "Dockerfile"
28+
args = {
29+
PULUMI_VERSION = "${PULUMI_VERSION}",
30+
PULUMICTL_VERSION = "${PULUMICTL_VERSION}"
31+
GOLANGCI_LINT_VERSION = "${GOLANGCI_LINT_VERSION}"
32+
GORELEASER_VERSION = "${GORELEASER_VERSION}"
33+
}
34+
labels = {
35+
"org.opencontainers.image.authors" = "https://graplsecurity.com"
36+
"org.opencontainers.image.source" = "https://github.com/grapl-security/pulumi-provider-build-environment",
37+
"org.opencontainers.image.vendor" = "Grapl, Inc."
38+
}
39+
tags = [
40+
"docker.cloudsmith.io/grapl/raw/pulumi-provider-build-environment:${PULUMI_VERSION}"
41+
]
42+
}

0 commit comments

Comments
 (0)