-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
Dockerfile.options
137 lines (104 loc) Β· 6.32 KB
/
Dockerfile.options
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# Banner is what is displayed at startup and on every command line
# in order to distinguish this image from other similar images
ENV BANNER "geodesic"
ENV MOTD_URL=http://geodesic.sh/motd
# Shell customization
# options for `less`. `R` allows ANSI color codes to be displayed while stripping out
# other control codes that can cause `less` to mess up the screen formatting
ENV LESS=R
# Our older Geodesic configurations relied on `direnv`, which we no longer recommend,
# preferring YAML configuration files instead.
ENV DIRENV_ENABLED=true
# When using Terraform worksapces, you can enable special prompt support
ENV GEODESIC_TF_PROMPT_ENABLED=true
# Our older Geodesic configuration uses multiple Makefiles, like Makefile.tasks
# and depends on this setting, however this setting is set by default by `direnv`
# due to rootfs/conf/.envrc, but `direnv` is now disabled by default, too.
# If you are using (and therefore enable) `direnv`, consider the advantage
# of using `direnv` to set MAKE_INCLUDES, which is that it will only set
# it for trusted directories under `/conf` and therefore it will not affect
# `make` outside of this directory tree.
ENV MAKE_INCLUDES="Makefile Makefile.*"
#
# Install Google Cloud SDK (requires Python)
# This is separate so that updating it does not invalidate the Docker cache layer with all the packages installed above
# https://cloud.google.com/sdk/docs/release-notes
ARG GOOGLE_CLOUD_CLI_VERSION
ENV CLOUDSDK_CONFIG=/localhost/.config/gcloud/
RUN apt-get update && apt-get install -y google-cloud-cli=${GOOGLE_CLOUD_CLI_VERSION}-\*
# gcloud config writes successful status updates to stderr, but we want to preserve
# stderr for real errors in need of action.
RUN { gcloud config set core/disable_usage_reporting true --installation && \
gcloud config set component_manager/disable_update_check true --installation && \
gcloud config set metrics/environment github_docker_image --installation; } 2>&1
####################################################################################
# kops support
# If you are using Cloud Posse's kops reference architecture, you con configure it
# in your Dockerfile like this (edit as desired)
ENV KOPS_CLUSTER_NAME=example.foo.bar
ENV KOPS_MANIFEST=/conf/kops/manifest.yaml
ENV KOPS_TEMPLATE=/templates/kops/default.yaml
ENV KOPS_STATE_STORE s3://undefined
ENV KOPS_STATE_STORE_REGION us-east-1
ENV KOPS_FEATURE_FLAGS=+DrainAndValidateRollingUpdate
ENV KOPS_BASTION_PUBLIC_NAME="bastion"
ENV KUBECONFIG=/dev/shm/kubecfg
ENV KUBECONFIG_TEMPLATE=/templates/kops/kubecfg.yaml
RUN /usr/bin/kops completion bash > /etc/bash_completion.d/kops.sh
# Instance sizes for kops bastion, master nodes, and worker nodes
ENV BASTION_MACHINE_TYPE "t3.small"
ENV MASTER_MACHINE_TYPE "t3.medium"
ENV NODE_MACHINE_TYPE "t3.medium"
# Min/Max number of nodes (aka workers) per region
ENV NODE_MAX_SIZE 2
ENV NODE_MIN_SIZE 2
# end of kops support section
####################################################################################
#### ALPINE ONLY ####
# Alpine does not include the very common `glibc` GNU C Standard Library, which
# causes compatibility problems. Among other things, AWS CLI v2 does not work
# out of the box with Alpine. The following recipe installs `glibc` , and has to be run
# before installing other packages, particularly `libc6-compat`, and then,
# because it conflicts, you have to tweak a bit and then install `libc6-compat`.
# So put this in Dockerfile.alpine after setting up the package repositories
# but before installing any packages https://github.com/cloudposse/geodesic/blob/91336bf56fb7ff0d9812e01ceacc40ca59a17cce/os/alpine/Dockerfile.alpine#L81
# (Not verified)
# Install glibc and glibc-bin and the C.UTF-8 locale
ENV LANG=C.UTF-8
ARG ALPINE_GLIBC_PACKAGE_VERSION=2.33-r0
RUN apk update && apk add -u curl && \
ALPINE_GLIBC_PACKAGE_VERSION="${ALPINE_GLIBC_PACKAGE_VERSION}" && \
curl -sSLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${ALPINE_GLIBC_PACKAGE_VERSION}/glibc-${ALPINE_GLIBC_PACKAGE_VERSION}.apk &&
apk add --allow-untrusted glibc-${ALPINE_GLIBC_PACKAGE_VERSION}.apk && rm glibc-${ALPINE_GLIBC_PACKAGE_VERSION}.apk && \
curl -sSLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${ALPINE_GLIBC_PACKAGE_VERSION}/glibc-bin-${ALPINE_GLIBC_PACKAGE_VERSION}.apk &&
apk add --allow-untrusted glibc-bin-${ALPINE_GLIBC_PACKAGE_VERSION}.apk && rm glibc-bin-${ALPINE_GLIBC_PACKAGE_VERSION}.apk && \
curl -sSLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${ALPINE_GLIBC_PACKAGE_VERSION}/glibc-i18n-${ALPINE_GLIBC_PACKAGE_VERSION}.apk &&
apk add --allow-untrusted glibc-i18n-${ALPINE_GLIBC_PACKAGE_VERSION}.apk && rm glibc-i18n-${ALPINE_GLIBC_PACKAGE_VERSION}.apk && \
/usr/glibc-compat/bin/localedef --force --inputfile POSIX --charmap UTF-8 "$LANG" || true && \
printf "export LANG=%s\n" "$LANG" > /etc/profile.d/locale.sh && \
apk del glibc-i18n && \
rm -f /usr/glibc-compat/lib/ld-linux-x86-64.so.2 && \
/usr/glibc-compat/sbin/ldconfig
# Remove conflicting link, install libc6-compat, restore link to glibc
RUN mv /lib64/ld-linux-x86-64.so.2 /lib64/glibc-ld-linux-x86-64.so.2 && \
apk add --force-overwrite libc6-compat && \
rm -f /lib64/ld-linux-x86-64.so.2 && \
mv /lib64/glibc-ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 && \
/usr/glibc-compat/sbin/ldconfig
# Now you can install packages
# https://github.com/cloudposse/geodesic/blob/91336bf56fb7ff0d9812e01ceacc40ca59a17cce/os/alpine/Dockerfile.alpine#L81-L88
# Now you can move AWS CLI v1 aside, keep it as an alternative, and install AWS CLI v2
# Move AWS CLI v1 to aws1 and set up alternatives
RUN mv /usr/bin/aws /usr/local/bin/aws1 && \
update-alternatives --install /usr/local/bin/aws aws /usr/local/bin/aws1 1
# Install AWS CLI 2
# Get version from https://github.com/aws/aws-cli/blob/v2/CHANGELOG.rst
# We cannot automatically track the release versions, so we just install the latest
# ARG AWS_CLI_VERSION=2.1.34
RUN AWSTMPDIR=$(mktemp -d -t aws-inst-XXXXXXXXXX) && \
curl -sSsSL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64${AWS_CLI_VERSION:+-${AWS_CLI_VERSION}}.zip" -o "$AWSTMPDIR/awscliv2.zip" && \
cd $AWSTMPDIR && \
unzip -qq awscliv2.zip && \
./aws/install -i /usr/share/aws/v2 -b /usr/share/aws/v2/bin && \
update-alternatives --install /usr/local/bin/aws aws /usr/share/aws/v2/bin/aws 2 && \
rm -rf $AWSTMPDIR