-
Notifications
You must be signed in to change notification settings - Fork 8
/
Dockerfile.sdk
93 lines (71 loc) · 3.5 KB
/
Dockerfile.sdk
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
83
84
85
86
87
88
89
90
91
92
93
# syntax=docker/dockerfile:1.0.0-experimental
FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
ARG AWS_DEFAULT_REGION
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
ARG AWS_SESSION_TOKEN
ARG CFN_CLI_SDK
RUN apt-get update && apt-get install -y \
make \
git \
wget \
curl \
zip \
jq \
vim \
golang \
python3 python3-pip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
#RUN wget --quiet https://dl.google.com/go/go1.15.3.linux-amd64.tar.gz \
#&& tar -xf go1.15.3.linux-amd64.tar.gz \
#&& mv go /usr/local && chmod +x /usr/local/go
#RUN pip install --upgrade pip
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \
unzip awscliv2.zip && ./aws/install
COPY $CFN_CLI_SDK /cfn-cli-sdk
RUN pip3 install \
cfn-cli-sdk/cloudformation-cli-0.2.1.tar.gz \
cfn-cli-sdk/cloudformation-cli-python-plugin-2.1.3.tar.gz \
cfn-cli-sdk/cloudformation-cli-python-lib-2.1.6.tar.gz
RUN echo "CloudFormation CLI Version"
RUN cfn --version
#RUN pip3 install cloudformation-cli-go-plugin
#
RUN cd cfn-cli-sdk && unzip goplugin.zip
RUN pip3 install -e cfn-cli-sdk/Github-cloudformation-cli-go-plugin
RUN pip3 list | grep cloudformation-cli
# Install mongocli
RUN MCLI_TAG=$(curl -sL --header "Accept: application/json" https://github.com/mongodb/mongocli/releases/latest | jq -r '.["tag_name"]') && \
MCLI_VERSION=$(echo $MCLI_TAG | cut -dv -f2) && \
MCLI_DEB="mongocli_${MCLI_VERSION}_linux_x86_64.deb" && \
curl -OL https://github.com/mongodb/mongocli/releases/download/${MCLI_TAG}/${MCLI_DEB} && \
echo "About to install mongocli from: ${MCLI_DEB}" && \
dpkg -i ${MCLI_DEB}
ENV WORKSPACE /workspace
RUN mkdir -p -m 0600 ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts
RUN --mount=type=ssh,id=github git clone --single-branch --branch develop git@github.com:aws-quickstart/quickstart-mongodb-atlas.git
#RUN --mount=type=ssh,id=github git clone --single-branch --branch develop git@github.com:jasonmimick/quickstart-mongodb-atlas.git
RUN --mount=type=ssh,id=github git clone git@github.com:aws-quickstart/quickstart-mongodb-atlas-resources.git
RUN cd quickstart-mongodb-atlas-resources/cfn-resources && \
go mod edit \
--replace github.com/aws-cloudformation/cloudformation-cli-go-plugin=/cfn-cli-sdk/Github-cloudformation-cli-go-plugin
# copy the repository form the previous image
#COPY --from=intermediate /quickstart-mongodb-atlas /workspace/quickstart-mongodb-atlas
#COPY --from=intermediate /quickstart-mongodb-atlas-resources /workspace/quickstart-mongodb-atlas-resources
# ... actually use the repo :)
## Fix importpath BUG work around
#
COPY fix-importpath.py /
RUN chmod +x fix-importpath.py
#RUN ls /quickstart-mongodb-atlas-resources/cfn-resources/**/.rpdk-config | xargs -I {} sh -c 'echo "Fixing: $1"' -- {}
RUN ls /quickstart-mongodb-atlas-resources/cfn-resources/**/.rpdk-config | xargs -I {} sh -c '/fix-importpath.py "$1" > "$1.fixed"' -- {}
RUN ls /quickstart-mongodb-atlas-resources/cfn-resources/**/.rpdk-config | xargs -I {} sh -c 'mv "$1.fixed" "$1"' -- {}
RUN ls /quickstart-mongodb-atlas-resources/cfn-resources/**/.rpdk-config | xargs -I {} sh -c 'cat "$1"' -- {}
# Pre build everything
RUN cd /quickstart-mongodb-atlas-resources/cfn-resources/ && BUILD_ONLY=true ./cfn-submit-helper.sh
# copy the build logs over to different name to help troubleshoot deployment logs
RUN cd /quickstart-mongodb-atlas-resources/cfn-resources/ && ls **/rpdk.log | xargs -I {} mv {} {}.build
COPY get-setup-aws-cfn.sh /
ENTRYPOINT ["/bin/bash", "-c"]