forked from cloud-custodian/cloud-custodian
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dependency-Dockerfile
59 lines (47 loc) · 1.99 KB
/
Dependency-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
# Dockerfiles are generated from tools/dev/dockerpkg.py
FROM ubuntu:20.04 as build-env
# pre-requisite distro deps, and build env setup
RUN adduser --disabled-login --gecos "" custodian && \
apt-get --yes update && \
apt-get --yes install build-essential curl python3-venv python3-dev --no-install-recommends && \
python3 -m venv /usr/local && \
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.2.0 python3
WORKDIR /src
# Add core & aws packages
ADD pyproject.toml poetry.lock README.md /src/
ADD c7n /src/c7n/
RUN . /usr/local/bin/activate && $HOME/.local/bin/poetry install --no-dev
RUN . /usr/local/bin/activate && pip install -q wheel
RUN . /usr/local/bin/activate && pip install -q aws-xray-sdk psutil jsonpatch
# Add provider packages
ADD tools/c7n_gcp /src/tools/c7n_gcp
RUN rm -R tools/c7n_gcp/tests
ADD tools/c7n_azure /src/tools/c7n_azure
RUN rm -R tools/c7n_azure/tests_azure
ADD tools/c7n_kube /src/tools/c7n_kube
RUN rm -R tools/c7n_kube/tests
ADD tools/c7n_openstack /src/tools/c7n_openstack
RUN rm -R tools/c7n_openstack/tests
# Install requested providers
ARG providers="azure gcp kube openstack"
RUN . /usr/local/bin/activate && \
for pkg in $providers; do cd tools/c7n_$pkg && \
$HOME/.local/bin/poetry install && cd ../../; done
RUN mkdir /output
FROM quay.io/sysdig/sysdig-mini-ubi:1.5.3
LABEL name="cli" \
repository="http://github.com/cloud-custodian/cloud-custodian"
COPY --from=build-env /src /src
COPY --from=build-env /usr/local/bin /usr/local/bin
COPY --from=build-env /usr/local/lib /usr/local/lib
COPY --from=build-env /output /output
RUN microdnf -y module enable python38:3.8 && \
microdnf -y --disableplugin=subscription-manager --setopt=tsflags=nodocs install python38 python38-devel python38-setuptools python38-pip shadow-utils && \
microdnf -y clean all
RUN adduser custodian
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"]