forked from cloud-custodian/cloud-custodian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
44 lines (39 loc) · 1.62 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
FROM python:3.7-slim-stretch
LABEL name="custodian" \
description="Cloud Management Rules Engine" \
repository="http://github.com/cloud-custodian/cloud-custodian" \
homepage="http://github.com/cloud-custodian/cloud-custodian" \
maintainer="Custodian Community <https://cloudcustodian.io>"
# Transfer Custodian source into container by directory
# to minimize size
ADD setup.py README.md requirements.txt /src/
ADD c7n /src/c7n/
ADD tools/c7n_gcp /src/tools/c7n_gcp
ADD tools/c7n_azure /src/tools/c7n_azure
WORKDIR /src
RUN adduser --disabled-login custodian
RUN apt-get --yes update \
&& apt-get --yes install build-essential --no-install-recommends \
&& pip3 install -r requirements.txt . \
&& pip3 install -r tools/c7n_gcp/requirements.txt tools/c7n_gcp \
&& pip3 install -r tools/c7n_azure/requirements.txt tools/c7n_azure \
# Pre-cache Azure Functions package
&& python -c "from c7n_azure.function_package import FunctionPackage; \
FunctionPackage('cache').build_cache( \
modules=['c7n', 'c7n-azure'], \
non_binary_packages=['pyyaml', 'pycparser', 'tabulate', 'pyrsistent'], \
excluded_packages=['azure-cli-core', 'distlib', 'future', 'futures'])" \
&& apt-get --yes remove build-essential \
&& apt-get purge --yes --auto-remove -o APT::AutoRemove::RecommendsImportant=false \
&& rm -Rf /var/cache/apt/ \
&& rm -Rf /var/lib/apt/lists/* \
&& rm -Rf /src/ \
&& rm -Rf /root/.cache/ \
&& mkdir /output \
&& chown custodian: /output
USER custodian
WORKDIR /home/custodian
ENV LC_ALL="C.UTF-8" LANG="C.UTF-8"
VOLUME ["/home/custodian"]
ENTRYPOINT ["/usr/local/bin/custodian"]
CMD ["--help"]