generated from pulumi/pulumi-tf-provider-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
82 lines (65 loc) · 1.82 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
ARG base_image=golang:1.19.5-alpine3.17
FROM $base_image as base_image
SHELL ["/bin/sh", "-euxo", "pipefail", "-c"]
RUN \
--mount=type=cache,target=/var/cache/apk \
apk add --no-cache \
bash \
curl \
git \
jq \
make \
nodejs \
terraform \
yarn \
; \
:;
SHELL ["/bin/bash", "-euxo", "pipefail", "-c"]
COPY ./provider/go.* /app/provider/
WORKDIR /app
RUN \
curl -fsSL https://get.pulumi.com -o /tmp/pulumi-install.sh; \
chmod +x /tmp/pulumi-install.sh; \
cd /app/provider; \
/tmp/pulumi-install.sh \
--version \
"$(go list -m -u -json "github.com/pulumi/pulumi/sdk/v3" | jq --raw-output '.Version[1:]')" \
; \
:;
ENV PATH="/root/.pulumi/bin:${PATH}"
COPY ./assets/root/.terraformrc /root/.terraformrc
COPY ./ /app/
RUN \
cd /app/tftest; \
terraform init; \
:;
ENV PULUMICTL_VERSION="0.0.41"
RUN \
git clone --depth=1 --branch="v${PULUMICTL_VERSION}" https://github.com/pulumi/pulumictl/ /tmp/pulumictl; \
cd /tmp/pulumictl; \
make; \
make install; \
:;
RUN \
cd /app/provider; \
go mod tidy; \
go build; \
cd /app; \
#Disable CGO to get a static exe. We end up with trouble on other platforms that don't use musl otherwise.
CGO_ENABLED=0 make build; \
:;
COPY ./bundle /root/bundle
RUN \
cp /app/bin/pulumi-resource-megaport /root/bundle; \
:;
RUN \
if ldd /root/bundle/pulumi-resource-megaport; then false; fi; \
:;
ARG PACKAGE_VERSION="0.0.13"
RUN tar czvf "/root/pulumi-resource-megaport-v${PACKAGE_VERSION}-linux-amd64.tar.gz" --directory=/root/bundle .
RUN cp -a /app/sdk/nodejs/scripts /app/sdk/nodejs/bin/scripts
FROM scratch as pulumi-megaport-npm
ARG PACKAGE_VERSION="0.0.13"
COPY --from=base_image /root/.terraformrc /pulumi-megaport/.terraformrc
COPY --from=base_image /root/pulumi-resource-megaport-v${PACKAGE_VERSION}-linux-amd64.tar.gz /pulumi-megaport/
COPY --from=base_image /app/sdk/nodejs /pulumi-megaport/nodejs